forked from OperationCode/front-end
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
49 lines (43 loc) · 1.13 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
41
42
43
44
45
46
47
48
49
const withCSS = require('@zeit/next-css');
const withBundleAnalyzer = require('@zeit/next-bundle-analyzer');
const svgoConfig = require('./common/config/svgo');
const nextConfig = withCSS({
// NextCSS Config
cssModules: true,
cssLoaderOptions: {
// No need for importLoaders: 1 as its set to 1 when postcss.config.js exists
localIdentName: '[name]_[local]__[hash:base64:5]',
},
// Bundle Analyzer Config
analyzeServer: process.env.ANALYZE,
analyzeBrowser: process.env.ANALYZE,
bundleAnalyzerConfig: {
server: {
analyzerMode: 'server',
analyzerPort: 8888,
},
browser: {
analyzerMode: 'server',
analyzerPort: 8889,
},
},
// Webpack Config
webpack: config => {
// Fixes npm packages that depend on `fs` module
// eslint-disable-next-line no-param-reassign
config.node = { fs: 'empty' };
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: 'react-svg-loader',
options: {
svgo: svgoConfig,
},
},
],
});
return config;
},
});
module.exports = withBundleAnalyzer(nextConfig);