butternut
butternut copied to clipboard
The fast, future-friendly minifier
Via https://github.com/Rich-Harris/butternut/issues/118#issuecomment-302134938 — good list of things to test in https://api.cdnjs.com/libraries
I tried to squash [es6-shim](https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js), which among other things provides a polyfill for `String.prototype.startsWith`. There seem to be [intentional misbehaviours](https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L865-L868) in the source code, which lets Butternut fail its job....
I've encountered errors in multiple instances where acorn was complaining about certain structures like `with` blocks or deleting variables "in strict mode". The point is that the source files handled...
**Input:** ` if(x)if(y){} ` **Output Butternut:** ` x&&() ` **Output UglifyJS:** ` if(x)if(y){} `
I tried to squash [analytics.js](https://cdnjs.cloudflare.com/ajax/libs/analytics.js/2.9.1/analytics.min.js) in the Butternut JavaScript API. The code contains `eval` calls, but since I have `allowDangerousEval` set to `true`, this should not be an issue for...
I'm curious whether it would make sense to introduce some kind of deoptimization guard, which does not apply the optimization (or maybe throws an error to tell that something is...
[Repro](https://butternut.now.sh/?version=0.4.4&gist=cf99651d4761f7ece4e0e29067a3df59)
I was wondering how `uglify-es` was able to compete with Butternut by only mangling variable names. For example, Preact: | | minified | zipped | time | |-------------------------|----------|----------|----------| | butternut...
This already happens in simple cases: ```js // input function foo () { console.log(1); return; console.log(2); } // output function foo(){console.log(1)} ``` But it fails if there's a declaration after...
More advanced version of #104 and #105: ```js // input function foo () { function bar () { return 42; } var answer = bar(); console.log(answer); } // output function...