Thank you for the article. I have gone through all these problems and finally reached a solution that works.

You have mentioned the use of UglifyJS and maybe that is a problem because it removes helpful comments for the webpack to remove the unused code. Shouldn’t you have not used UglifyJS and let webpack4 do minification for you have done the tree-shaking? Also, I don’t understand why you need rollup to transform libraries to tree-shakable output with imports and exports and rest converted to es5. I use typescript configured to target es6, module es6, and module type to “node” and generate a similar output as Rollup.

There is a plugin called Deep Scope Analysis for the webpack that does further tree-shaking, but unfortunately, it didn’t work for me due to some errors.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Afiz Momin

Afiz Momin

More from Medium

Why I Love Ed O’Bannon

Gameplay Journal 1

Unmasked

Reel Women Fish.