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

Docs about tree-shaking for contributors #997

Closed
m0ksem opened this issue Aug 10, 2021 · 2 comments · Fixed by #1159
Closed

Docs about tree-shaking for contributors #997

m0ksem opened this issue Aug 10, 2021 · 2 comments · Fixed by #1159
Assignees
Labels
ASAP We want it yesterday! docs packages/docs

Comments

@m0ksem
Copy link
Collaborator

m0ksem commented Aug 10, 2021

Write about things that developers should worry about while working on the project. (While I remember all this 😁)

@m0ksem m0ksem added docs packages/docs ASAP We want it yesterday! labels Aug 10, 2021
@m0ksem m0ksem self-assigned this Aug 10, 2021
@olivierceulemans
Copy link

I'm not a contributor (yet) but I'm really impatient to find out how you managed to avoid this really annoying treeshaking bug in vuejs 3. I tried to reproduce what you did in vuestic on my (closed source) project but without success. This is a clear vuejs 3 showstopper for me... to the point of considering a revert to vuejs 2. vuejs/core#2860

@m0ksem
Copy link
Collaborator Author

m0ksem commented Aug 16, 2021

@olivierceulemans, actually, tree-shaking is a kind of a weird thing for now. We moved from webpack to rollup for building esm packages using rollup-vue-plugin (which is not supported after 2020 and moved to @vitejs/plugin-vue instead). For some reason, vite's esbuild is broken on js_commonjs_loader (huh) so we use rollup instead. A simple solution for tree-shaking is preserveModule option that separates files into js modules.

After a while, I found that our components can not be rendered after vite's build command. I'll make a fix for vite in a few days, but I am sure that there will be more issues again.

I am 100% sure tree-shaking can be provided if you specify all components as inputs for rollup instead preservedModules. I tested with local lib and it works fine.

Actualy, you can find that vite is not capable with preservedModules and usually you need to use manualChunks instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASAP We want it yesterday! docs packages/docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants