/
next.config.js
38 lines (33 loc) · 989 Bytes
/
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
/**
* @prettier
*/
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable filenames/match-regex */
/* eslint-disable import/no-extraneous-dependencies */
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const WebpackBar = require('webpackbar');
const withCSS = require('@zeit/next-css');
/* eslint-enable import/no-extraneous-dependencies */
// eslint-disable-next-line immutable/no-mutation
module.exports = withCSS({
useFileSystemPublicRoutes: false,
webpack(config, { isServer }) {
// use the bundle analyzer if `ANALYZE` is enabled
if (process.env.ANALYZE) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true,
}),
);
}
config.plugins.push(
new WebpackBar({
color: isServer ? 'orange' : 'green',
name: isServer ? 'server' : 'client',
}),
);
return config;
},
});