adams85 / bundling

A library for optimizing and bundling web assets of ASP.NET Core applications.
MIT License
42 stars 7 forks source link

Tree shaking in EcmaScript #10

Open ISV-Kran opened 3 years ago

ISV-Kran commented 3 years ago

Hi adams85 and thanks for this great bundling.

I'm using EcmaScript for ES6 support and it seems the whole file has being imported. Is it possible to eliminate dead code and import only what is really needed?

TO REPRODUCE THE CASE: In TypeScriptDemo add a "treeShaking" function to foo.js. Running the application main.js will include the function, even if it has not been imported.

WHAT EXPECTED: main.js without the "treeShaking" function.

adams85 commented 3 years ago

Hi!

Unfortunately, tree shaking is not implemented currently. It would definitely be useful but according to my estimations it needs a considerable time investment, which I can't afford anytime soon.

But I'll leave open your issue as I'd like to include this feature in the lib eventually.

ISV-Kran commented 3 years ago

Great news here! Tree shaking is already performed by Nuglify during minification, so there is no need to implement it.

Keep this project up, is awesome and well implemented :)