3 ms·
>They're there because popular packages like Babel, Webpack, ESLint and others chose to use NPM modules to organize themselves, instead of using function and cl
by offtop5 6y ago
>They're there because popular packages like Babel, Webpack, ESLint and others chose to use NPM modules to organize themselves, instead of using function and classes like everything else.
You can't build anything without Babel for the most part since ES6 code needs it to transpile down to ES5.
The end result is JavaScript's entire ecosystem is a fragile mess.
- kitten_mittens_ 6y agoTwo of my last three jobs did NOT need to compile down to ES5. The current shop is supporting only ES2020 browsers.
- offtop5 6y agoDoesn't typescript force Babel ?
- acemarke 6y agoNo. Typescript is its own entirely separate standalone compiler toolchain. If you are using Babel as a compiler, you can enable the TS syntax plugin to have Babel strip TS type syntax out of its processing output, although this does not do any typechecking during the compilation process.
- offtop5 6y agoGreat. I'm always open to being proved wrong. Any chance of JS being mostly Babel free by next year ?
- acemarke 6y agoAh... no, not in the slightest. Every major web framework's standard build tools (Create-React-App, Vue-CLI, etc), are based on Webpack + Babel, and most folks who are using one of those frameworks but setting up their own build toolchains still base them around Webpack + Babel. There's some potentially interesting technical alternatives out there, but Babel is a keystone in the modern JS ecosystem.
- crucialfelix 6y agoSince typescript tsc can compile js, you could switch to using the typescript compiler to compile your javascript. It would also detect some probable bugs in your js code. Of course after a day or two you would start writing typescript and never look back.
- ratww 6y agoAs other posters have already answered you: no, you don't need it. You can even use ES6 modules directly in the browser, including import/export syntax. When I measured back in 2018 100% of our users of the company I was I was in had support for that. With brotli and HTTP2 the performance is comparable to bundled code. The only holdover is JSX, of course, and maybe some things like the ?? operator that don't work in the client-side yet. But Typescript can take care of that. You can even tell Typescript to target ES6 so you can use ES6 modules in the browser, and this will let you eschew Webpack. So no, you don't really need Babel in 2020. :)