5 ms·
If you're only using standard ES6 features, you may be able to switch to Buble. I got a pretty significant speedup after switching one project to Buble ES6 com
by jnbiche 10y ago
If you're only using standard ES6 features, you may be able to switch to Buble. I got a pretty significant speedup after switching one project to Buble ES6 compiler.
https://buble.surge.sh/guide/ https://buble.surge.sh/guide/
- hueving 10y agoIf you're not, can you use Babel to use Buble?
- moron4hire 10y agoBuble is subtly broken in a number of ways. For example, if any of your method names mirror something you need in the global namespace, your method will clobber that global object. For example: class A { constructor() { this.handle = setInterval(/* blah */, 1000); } clearInterval() { clearInterval(this.handle); } } Becomes: function A() { this.handle = setInterval(/* blah */, 1000); } A.prototype.clearInterval = function clearInterval() { clearInterval(this.handle); }; And if you're switching from babel to buble, you'll be confused as to why you're suddenly getting a bunch of stack overflow errors. I have a fairly large project and don't see a significant difference in compile times between the two. Slowness in my build process usually means I've accidentally touched the node_modules directory in my gulp.src expression. It's not enough to use a negation! You have to avoid testing it completely.
- Zarel 10y agoHow does that clobber the global object? Are you talking about `function clearInterval()`? That doesn't go into the global scope. > let foo = function bar() {} undefined > bar ReferenceError: bar is not defined
- agency 10y agoIt doesn't overwrite the function on the global scope, but it does shadow the `clearInterval` name within the function definition, which I don't believe it should do according to the ES6 spec. Compare: https://buble.surge.sh/#class%20A%20%7B%0A%20%20clearInterval()%20%7B%0A%20%20%20%20console.log(this.clearInterval%20%3D%3D%3D%20clearInterval)%0A%20%20%7D%0A%7D%0A%0Anew%20A().clearInterval() https://buble.surge.sh/#class%20A%20%7B%0A%20%20clearInterva... with https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015%2Creact%2Cstage-2&experimental=true&loose=false&spec=false&code=class%20A%20%7B%0A%20%20clearInterval()%20%7B%0A%20%20%20%20console.log(this.clearInterval%20%3D%3D%3D%20clearInterval)%0A%20%20%7D%0A%7D%0A%0Anew%20A().clearInterval() https://babeljs.io/repl/#?babili=false&evaluate=true&lineWra...