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
unnamed import is being shaken away with tree shaking #1078
Comments
It's a bug, I thought I had a test for this though. Will check it out. |
@matthewp my old suggestion was wrong i now see the fail the fail is we import some thing that exports nothing look exactly at his code its not a global that gets treeshaken away he did not export anything so there is nothing @PieterSwitten this is expected result! Dont worksWhen I do a import like import './foobar.js' It will removed after the build. main.js import './foobar.js' foobar.js console.log('foobar');. WorksI have to explicit export something before it is not being removed in the build. foobar.js console.log('foobar');
export default {}; Then it does work after I have build. this is because the depdency foobar in the don't works example simply exports nothing this is not what we talk about in 'https://stealjs.com/docs/steal-tools.tree-shaking.html#preventing-code-removal' |
Ok, so there is a similar test, however the test exports a function. Once I removed the export the test no longer works. So I was able to recreate this. Now to figure out why... |
According to 'https://stealjs.com/docs/steal-tools.tree-shaking.html#preventing-code-removal' the
imports
without a variable should not be removed in the build by tree shaking.When I do a import like
import './foobar.js'
It will removed after the build.Inside
foobar.js
there is only one line withconsole.log('foobar');
.I have to explicit export something before it is not being removed in the build.
Then it does work after I have build.
Is this a bug in the tree shaking or is it the expected result and should we update our code?
The text was updated successfully, but these errors were encountered: