Skip to content

Commit 7949c46

Browse files
committed
feat(build): add rollup visualizer for bundle analysis
1 parent cd22911 commit 7949c46

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ nbproject
8484

8585
.coverage
8686
.node_history
87+
.stats
8788
dist
8889
lcov.info
8990
lib-cov

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"prettier": "3.3.3",
8080
"rimraf": "6.0.1",
8181
"rollup": "4.27.3",
82+
"rollup-plugin-visualizer": "5.12.0",
8283
"ts-jest": "29.2.5",
8384
"typescript": "5.6.3"
8485
},

pnpm-lock.yaml

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import nodeResolve from '@rollup/plugin-node-resolve';
33
import commonjs from '@rollup/plugin-commonjs';
44
import replace from '@rollup/plugin-replace';
55
import terser from '@rollup/plugin-terser';
6+
import { visualizer } from 'rollup-plugin-visualizer';
67

78
const isProduction = process.env.NODE_ENV === 'production';
89

@@ -65,6 +66,8 @@ const node_build = {
6566
}),
6667
// Only minify in production
6768
isProduction && terser(),
69+
// Analysis and visualization artifacts
70+
visualizer({ filename: '.stats/bundle.node.html', template: 'raw-data' }),
6871
],
6972
};
7073

@@ -120,7 +123,10 @@ const browser_build = {
120123
'process.browser': true,
121124
preventAssignment: true,
122125
}),
126+
// Minify the code
123127
terser(),
128+
// Analysis and visualization artifacts
129+
visualizer({ filename: '.stats/bundle.browser.html', template: 'raw-data' }),
124130
],
125131
};
126132

0 commit comments

Comments
 (0)