forked from styled-components/styled-components-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
32 lines (29 loc) · 882 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
const withSourceMaps = require('@zeit/next-source-maps');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const withMDX = require('@next/mdx');
module.exports = withMDX({
// Use .md extension
extension: /\.md$/,
})(
withSourceMaps({
pageExtensions: ['js', 'jsx', 'md'],
poweredByHeader: false,
webpack: function (config, { dev, isServer }) {
if (dev) {
return config;
}
if (!!process.env.ANALYZE) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
// For all options see https://github.com/th0r/webpack-bundle-analyzer#as-plugin
generateStatsFile: true,
// Will be available at `.next/stats.json`
statsFilename: 'stats.json',
})
);
}
return config;
},
})
);