Skip to content
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

Layercontrol bundle is very big #585

Closed
StefanBrand opened this issue Jan 16, 2024 · 3 comments · Fixed by #714
Closed

Layercontrol bundle is very big #585

StefanBrand opened this issue Jan 16, 2024 · 3 comments · Fixed by #714

Comments

@StefanBrand
Copy link
Member

dist/eox-layercontrol.js  954.39 kB │ gzip: 178.57 kB
dist/eox-layercontrol.umd.cjs  690.15 kB │ gzip: 155.66 kB
@StefanBrand
Copy link
Member Author

StefanBrand commented Jan 18, 2024

After #590 stats look like this:

dist/eox-layercontrol.js  547.90 kB │ gzip: 119.85 kB
dist/eox-layercontrol.umd.cjs  421.72 kB │ gzip: 102.76 kB

still a bit bulky. 🤔

This is the result of npx -w @eox/layercontrol vite-bundle-visualizer -o layercontrol-stats.html: layercontrol-stats.zip

image

We can see that via jsonform we bundle all theme providers (bootstrap<n>.js...), while we probably don't want to bundle all of them.

@StefanBrand
Copy link
Member Author

We should probably move jsonform into it's own chunk because in many cases it will not be used by the downstream application.

@StefanBrand StefanBrand removed their assignment Jan 18, 2024
@StefanBrand
Copy link
Member Author

StefanBrand commented Jan 18, 2024

import "../../../jsonform/src/main";

could be changed

- import "../../../jsonform/src/main";
+ import("../../../jsonform/src/main");

which results in

dist/eox-layercontrol.js    0.08 kB │ gzip:  0.09 kB
dist/main-9gFS82QB.js     151.27 kB │ gzip: 41.08 kB
dist/main-LP96rjgB.js     396.83 kB │ gzip: 79.39 kB
dist/eox-layercontrol.umd.cjs  421.87 kB │ gzip: 102.75 kB

This is not ideal because it makes a very small entry point file and two main-<hash>.js files, which are difficult to identify. Possibly we can use https://rollupjs.org/configuration-options/#output-manualchunks, but I found this to conflict with the UMD bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants