Skip to content

Commit 7e158cf

Browse files
committed
Add rollup bundle visualizer
1 parent 0743825 commit 7e158cf

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ docs/
1111
/styles/
1212
coverage/
1313
.vscode/
14+
stats.html

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"rimraf": "^3.0.2",
162162
"rollup": "2.79.2",
163163
"rollup-plugin-styles": "4.0.0",
164+
"rollup-plugin-visualizer": "6.0.5",
164165
"style-loader": "^0.23.1",
165166
"svg-url-loader": "^6.0.0",
166167
"ts-loader": "^8.0.2",

rollup.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import commonjs from '@rollup/plugin-commonjs'
55
import styles from 'rollup-plugin-styles'
66
import terser from '@rollup/plugin-terser'
77
import { exec } from 'child_process'
8+
import { visualizer } from 'rollup-plugin-visualizer'
89

910
const isWatchMode = process.env.ROLLUP_WATCH === 'true'
1011
const onSuccessCallback = process.env.ON_SUCCESS
@@ -79,6 +80,7 @@ function createConfig({
7980
preserveModules,
8081
withDeclarations,
8182
withMinification,
83+
withVisualizer,
8284
onSuccessCommand,
8385
}) {
8486
return {
@@ -116,6 +118,7 @@ function createConfig({
116118
]
117119
: []),
118120
...(withMinification ? [terser()] : []),
121+
...(withVisualizer ? [visualizer({ gzipSize: true })] : []),
119122
...(onSuccessCommand ? [onSuccess(onSuccessCommand)] : []),
120123
],
121124
}
@@ -126,6 +129,7 @@ const es = createConfig({
126129
format: 'esm',
127130
outputDir: 'es',
128131
preserveModules: true,
132+
withVisualizer: true,
129133
})
130134

131135
// CJS unbundled build with TypeScript declarations (lib/ folder)

0 commit comments

Comments
 (0)