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
fix(url): Tree-shake emitting files #435
Conversation
Thanks for opening this PR. I'd definitely call this a bugfix. We'll definitely need some tests around this to verify it's working correctly and to prevent regressions, before we can merge. |
I've just noticed that sometimes people just need to import some stuff without actually referencing it in the code, example. And this PR misses such files cuz it relies on From that It seems to me that not So DO NOT MERGE this version :) I'm going to fix it and provide tests |
Well, I have added test and fixed prettier issues. Regarding of this comment: I didn't find a way to "teach" Rollup that such import is intentional and should not be tree-shaked. Btw, I had an idea to check all of the imported file parent modules for not being tree-shaked (i.e. to belong to So @shellscape do you have any vision on this? |
rollup/rollup#3663 should give you the solution you are looking for. |
@artemjackson please take a look at the commit lukas referenced and let us know if that resolves the issues you mentioned. It looks like this is ready to go now. |
Heads up: Once this hits 60 days without activity the PR will be closed. Please take a look before we reach that point! |
Rollup Plugin Name:
url
This PR contains:
Are tests included?
Breaking Changes?
Description
Currently @rollup/plugin-url does not respect Rollup's Tree-shaking.
So all imported files are copied to destination folder even if a parent module has been actually tree-shaked by Rollup.
Simplified example:
This is bundled to:
Despite of
foo.js
was actually tree-shaked:I'm not sure what the PR is a feature or a bugfix, so some help needed to classify it