Skip to content

Instantly share code, notes, and snippets.

View danbucholtz's full-sized avatar

Dan Bucholtz danbucholtz

View GitHub Profile
@IgorMinar
IgorMinar / _purify.md
Last active March 30, 2017 11:55
purify.js with cli and webpack plugin - simple and super-hackish Uglify pre-optimizer

This is a super-hacky tool that processes JavaScript bundless before they are fed to Uglify.

Purify adds @__PURE__ annotation in front of all IIFE's that represent ES classes downleveled by TypeScript.

This annotation then enables Uglify 2.8+ to safely recognize if the class is not used and remove it.

You can use it webpack-plugin or cli.

Angular developers will need the bundle to be also processed by alxhub/ngo before the full effect can be seen.