Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Node standard library doesn't do enough compared to Python. Python in a locked down environment ( you can't just install whatever you want ) isn't bad.

Node is a nightmare without being able to install various packages from npm. Thus someone can remove Left Pad and it's the end of the world. I switched from React Native to Flutter for mobile app development and it was one of the best decisions I've ever made



This is an outdated perspective, unfortunately. Left-pad is a 2015 problem. In 2020 we already have padStart in every evergreen browser and in Node.js, and it's been there for years.

The reason the JS library is slimmer than Pythons is because it's mostly a client-side language. It doesn't have to handle Unix filesystems, web crawling or even security, because the client-side is not really the place for it, so comparing Python to JS is not really useful, because Python is mostly used in the server-side, and most server-side JS projects already use very few dependencies.

Most of the complex things like URL Requests and HTML parsing are handled by the browser or the DOM.

And it's the client-side projects that are bloated and using hundreds (if not thousands) of dependencies. But those dependencies are not there because the language is lacking. 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.


> The reason the JS library is slimmer than Pythons is because it's mostly a client-side language.

This comment is a bad argument. The web API in the browser is substantial, from USB communication to XML parsing.

None of that is shipped with Node.js directly for instance.

The problem is not the Javascript spec, the problem is that one has to download a package to parse XML with Node.js. Node.js standard library is too barebone.

You don't have to do that in the client. You have loads of web API, perhaps more than Python's standard library.


Web API is sandboxed with a permission model in the browser.


> Web API is sandboxed with a permission model in the browser.

And? your comment has absolutely nothing to do with my point which is that JS in the browser has access to a huge standard API compared to Node.js which relies too much on third party packages, unlike Python or Go.


>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.


As 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. :)


Two of my last three jobs did NOT need to compile down to ES5. The current shop is supporting only ES2020 browsers.


Doesn't typescript force Babel ?


No. 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.


Great. I'm always open to being proved wrong.

Any chance of JS being mostly Babel free by next year ?


Ah... 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.


Since 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: