Skip to content

Commit fe1d8d8

Browse files
committed
feat: add bundle size analyzer
1 parent d08014a commit fe1d8d8

File tree

3 files changed

+376
-2
lines changed

3 files changed

+376
-2
lines changed

next.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
const withPreact = require('next-plugin-preact');
2+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
23

34
module.exports = withPreact({
5+
webpack: (config, { isServer }) => {
6+
if (process.env.ANALYZE) {
7+
config.plugins.push(
8+
new BundleAnalyzerPlugin({
9+
analyzerMode: 'server',
10+
analyzerPort: isServer ? 8888 : 8889,
11+
openAnalyzer: true,
12+
})
13+
);
14+
}
15+
return config;
16+
},
417
experimental: {
518
modern: true,
619
},

0 commit comments

Comments
 (0)