-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analyze Cockpit bundle sizes #18267
Comments
We could, only import the locales which are required. |
By doing the following changes in the build.js one can generate a meta.json file [kkoukiou@sequioa cockpit]$ git diff
diff --git build.js build.js
index d20324070..60059d8ed 100755
--- build.js
+++ build.js
@@ -225,6 +225,7 @@ async function build() {
} else {
// with native esbuild, build everything in one go, that's fastest
const pkgContext = await esbuild.context({
+ metafile: true,
...pkgOptions,
entryPoints,
plugins: [...pkgFirstPlugins, ...pkgPlugins, ...pkgLastPlugins],
@@ -241,7 +242,8 @@ async function build() {
});
try {
- await Promise.all([pkgContext.rebuild(), qunitContext.rebuild()]);
+ const result = await Promise.all([pkgContext.rebuild(), qunitContext.rebuild()]);
+ fs.writeFileSync('meta.json', JSON.stringify(result[0].metafile));
} catch (e) {
if (!args.watch)
process.exit(1);
Which can be then fed to https://esbuild.github.io/analyze/ |
@KKoukiou: Nice! Do you want to add that as a CLI option to ./build.js? Or is this cheap enough that we could just always do that? |
@martinpitt I definitely want to introduce it as a CLI option and I want to introduce some check for bundle size changes, so if bundle size increases by >5% there should be an error in CI. |
In our cockpit plugins we now generate an esbuild metadata file which can be used to analyze the bundle size cockpit-project/starter-kit@49c3688 |
ESbuild supports outputting a metadata file which can be used to view bundle size information using https://esbuild.github.io/analyze/ Closes: cockpit-project#18267
ESbuild supports outputting a metadata file which can be used to view bundle size information using https://esbuild.github.io/analyze/ Closes: #18267
Add the webpack bundle analyzer to package.json and the webpack config and run
./tools/webpack-make $page
.Biggest modules:
systemd/services.js (3.6 MB)
kdump (1.69 MB)
users 3.3MB
storaged 3.8 MB
Note: the bundle does include
test-util.js
. for storaged/kdumpThe text was updated successfully, but these errors were encountered: