-
Notifications
You must be signed in to change notification settings - Fork 2
/
next.config.js
40 lines (37 loc) · 1.21 KB
/
next.config.js
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
// eslint-disable-next-line @typescript-eslint/no-var-requires
// const withBundleAnalyzer = require('@next/bundle-analyzer')({
// enabled: process.env.NODE_ENV === 'production',
// });
// eslint-disable-next-line @typescript-eslint/no-var-requires
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = {
compress: process.env.NODE_ENV === 'production',
swcMinify: true,
eslint: {
ignoreDuringBuilds: true,
},
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
webpack(config) {
let isProd = process.env.NODE_ENV === 'production';
let plugins = [...config.plugins];
if (isProd) {
plugins.push(new CompressionPlugin());
}
config.resolve.modules.push(__dirname);
return {
...config,
mode: isProd ? 'production' : 'development',
// devtool: prod ? 'hidden-source-map' : 'eval',
// devtool: prod ? 'hidden-source-map' : 'source-map',
devtool: isProd ? 'hidden-source-map' : 'inline-source-map',
plugins,
// plugins: [
// ...config.plugins,
// // 배포용일때만 추가
// // process.env.NODE_ENV === 'production' && new CompressionPlugin(),
// ],
};
},
};