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

Importing one component in library mode imports all #55

Closed
lewishowles opened this issue Oct 10, 2020 · 4 comments
Closed

Importing one component in library mode imports all #55

lewishowles opened this issue Oct 10, 2020 · 4 comments

Comments

@lewishowles
Copy link

lewishowles commented Oct 10, 2020

Thanks for the tool, it really helped me get up and running with our component library for Vue 3!

I'm not sure if this is something to do with how the library is generated, or how Vite is building the final app, but I'm using 4.0.0-beta.0 for a Vue 3 library used in a Vue 3 project, which is built with Vite, and I noticed that tree shaking for the output library doesn't seem to work. I saw #39 but I'm not sure if that's the same issue.

I'm importing the esm version, and we have around 91 helper components. It seems like importing one or more of the components into the app - e.g. import { SimpleDonut } from '@software2-libraries/ui-components'; takes the built file from 50k to 500k, and it doesn't matter how many components I try to import.

@mgdodge
Copy link
Collaborator

mgdodge commented Oct 19, 2020

Logged this bug today with rollup-plugin-vue, which addresses tree-shaking. The bug you referred to was for vue2, and had been resolved. It seemed to crop up again recently, due partially to upstream changes.

Just released v4.0.0-beta.1 which in my latest tests is very tree-shakeable for vue2, but not vue3 at all. The bug I logged illustrates that the tree-shaking issues are not due to this utility, since all it does is scaffold the config - the actual output is from rollup-plugin-vue.

The bug includes a sample repo showing the exact same code/config creating vastly different tree-shakability results between vue2 and vue3. You'll probably want to keep an eye on that bug report - when it gets resolved, there should be no need to change this utility unless rollup-plugin-vue gets a semver-major update as part of the fix.

@lewishowles
Copy link
Author

Great, thanks for taking a look!

@mgdodge
Copy link
Collaborator

mgdodge commented Dec 21, 2020

Updated my bug report just the other day with addl. research regarding tree-shaking in Vue 3 version. Still an upstream problem, but at least there is more info an a very manual workaround.

@mgdodge
Copy link
Collaborator

mgdodge commented Jul 15, 2022

The decision has been made to deprecate vue-sfc-rollup in favor of better tooling in the Vue ecosyste, specifically the vite "library build" configuration. It is an excellent project, which is capable of everything vue-sfc-rollup strived to accomplish, and more.

@mgdodge mgdodge closed this as completed Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants