4 ms·
> From someone stuck with dynamic languages, mark my words, it's best for your compiler to be a bit slow, than your brain being the compiler! lol, I'm on a pro
by k__ 10y ago
> From someone stuck with dynamic languages, mark my words, it's best for your compiler to be a bit slow, than your brain being the compiler!
lol, I'm on a project right now that uses ES2016 (dynamic) and I'm still stuck on a slow compiler.
- patates 10y agoSwitch to TypeScript or Flow. Then at least it's worth the wait (in terms of correctness).
- k__ 10y agoCan't switch in that project, but I will try TypeScript in the next
- jnbiche 10y agoIf 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...
- nostrademons 10y agoIf you're targeting modern browsers you may want to look into disabling all plugins except for modules. The latest version of every major browser supports ES2015 natively (as well as much of ES2016 and ES2017). There are various Babel presets (eg. babel-preset-modern) available on NPM that do this. Even if you're not targeting modern browsers, you might consider developing on Chrome with a very minimal, modules-only Babel config, and then running the full transform only when you're ready to QA & deploy.