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

Question regarding ES5/ES2015 #40

Open
amitdahan opened this issue Dec 27, 2016 · 4 comments
Open

Question regarding ES5/ES2015 #40

amitdahan opened this issue Dec 27, 2016 · 4 comments
Labels

Comments

@amitdahan
Copy link

Hey first of all, thanks for putting order into the chaos which is the current state of typescript-treeshaking!

I only have one question.
So the reason the Babili build is only transpiling to ES2015 is because the plugin itself needs ES2015 code to properly analyze dead code?
So in this case if need an ES5 bundle, we'd need to manually (or separately) transpile the bundle into ES5, or is there a way to tell Babili to eventually spit out ES5 code instead of ES2015?

Thanks!!

@sonicoder86
Copy link
Owner

First yes, Babili needs ES2015 code to operate properly, It accepts ES5 also, but won't remove the unused classes.
Babili is basically a set of Babel presets, so if it is possible to inject more presets to the plugin it will work to output ES5 code in the end. If it doesn't work from code, try adding them to .babelrc

@beiciye
Copy link

beiciye commented Jan 19, 2017

For ES5 bundle, it seems not working to use tree shaking with Babili.

@jack4it
Copy link

jack4it commented Jan 31, 2017

Maybe not the right place to ask this question, but @BlackSonic do you know why webpack doesn't directly remove the detected unused exports? But instead hands it over to Uglify to do the job, which it can't easily do because the static semantic is already lost after es6->es5 transpilation?

@sonicoder86
Copy link
Owner

@jack4it I think it is designed this way. Maybe after the release of Webpack 2 they will implement Rollup like tree-shaking

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

No branches or pull requests

4 participants