-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnext.config.ts
More file actions
52 lines (47 loc) Β· 1.23 KB
/
next.config.ts
File metadata and controls
52 lines (47 loc) Β· 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/** @type {import('next').NextConfig} */
// eslint-disable-next-line import/no-extraneous-dependencies
import CompressionPlugin from 'compression-webpack-plugin';
import type { NextConfig } from 'next';
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const nextConfig: NextConfig = {
webpack: (config, { isServer, dev }) => {
if (!isServer && !dev) {
config.plugins.push(
new CompressionPlugin({
algorithm: 'gzip',
test: /\.(js|css|html|svg)$/,
// 10KB λ―Έλ§μ νμΌμ μμΆνμ§ μμ΅λλ€.
threshold: 10240,
// μμΆλ₯ μ΄ 80% λ―Έλ§μΈ κ²½μ° μμΆ νμΌμ μμ±νμ§ μμ΅λλ€.
minRatio: 0.8,
}),
);
}
config.module.rules.push({
test: /\.svg$/i,
use: ['@svgr/webpack'],
});
return config;
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
port: '',
pathname: '/**',
},
],
},
turbopack: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
};
export default withBundleAnalyzer(nextConfig);