Rich-Harris / butternut

The fast, future-friendly minifier
https://butternut.now.sh
MIT License
1.17k stars 17 forks source link

Minify/remove top-level declarations in a module #68

Open Rich-Harris opened 7 years ago

Rich-Harris commented 7 years ago

If there's an import/export declaration, we know that this is a module and that it's therefore safe to a) mangle/remove top-level declarations, and b) remove 'use strict' pragmas.

Probably makes sense to have a module: true option to force it, in cases where there's no import/export.

(The mangling part also applies to CommonJS but I'm not sure it's worth worrying about that — it's rare to minify stuff for Node, and CommonJS will die out soon enough anyway.)