I love JS, but every once in a while a new bundler comes along that "solves everything". And it works, for a while. then it breaks. Why? Why are there so many edge cases? I don't understand it. We only have a few module types (AMD, CommonJS, ES modules), with a few types of import and export syntax. How hard can it be to get it always right?
Like parcel. It worked. For a while. And now if you check the GitHub there's 690 open issues, and I had issues today getting it to work when running after an 'npm i' done in v17 or v18, yet it's fine to run in v{16,17,18} if 'npm i' is done in v16.
And snowpack: v0 (or 1) worked great, but the next version broke so many things (compared to the prior version) that I need to keep the dep version locked to the earliest ones for packages where I use that. Tho I guess that's more of an API problem.
What I'm really talking about is: why can't we just have a bundler that works always and everywhere (and I don't want to 'wait for' deno)?
Why would parcel start to get bugs...how hard can it be??? :...(
- JS doesn’t have a proper standard library and so you tend to have many more dependancies in a project than with other languages.
- Because of that you then have a very large tree of dependancies, often with incompatible version requirements of the same package.
- Due to the nature of needing to “bundle” your code for distribution on a “slow” network, a lot of optimisations (tree shaking, code splitting, async module loading) are required to minimise your bundle size.
- You say “We only have a few module types”, that’s two more that every other language. And they are incomparable in subtle ways.
Those and some other issues are completely unique to the web platform, they are some difficult problems to solve.
However, I think the current generation of tooling has finally got there. Vite, with its esbuild and Rollup backend is bloody brilliant. If you use a framework with official Vite support it just works.
Unsurprisingly, because we've apparently decided Javascript needs to replace all existing languages in all current and future forms of application and system development, its actual standard library is no longer sufficient for many peoples' requirements. But they would rather claim the language "has no standard library" in order to justify the insane complexity of the JS ecosystem than admit that perhaps it just isn't the right tool for every job.
I avoid to the point of refuse to work with any JavaScript platform at all. They are a universal shit show.
Edit: honestly I stand by this comment. I literally have spent hours this year dealing with fucked up messes in nodejs, package security issues after repos were hacked and code made it into NPM that displayed banners on commercial sites. My comment is toxic yes but quite frankly both communities are as well (PHP and NodeJS) and utterly earned that ire and discontent. The fact people lean on the stack and produce stuff that handles critical aspects of people's lives is utterly frightening. So yeah toxic, I don't care. Feel free to be annoyed. It's still a turd, just been rolled in glitter.
PHP isn't my favorite language but using phrasing like "slither" to describe an entire community of developers is frankly shitty. Every language has its problems including whatever you use.
Oh no it's exactly right. Slithering is the word.
I don't get anywhere near this level of sheer incompetence on a daily basis in the Python, .Net or Go ecosystems. Nor do I have problems sleeping wondering what shit show am I going to face on a Monday morning with them.
PHP has some sort of standard library but it's not intuitive (the function naming is a mess), sometimes outdated, wrong or broken (but the broken behavior has now ossified and will never be removed for backwards-compatibility reasons).
JS has basically no standard library at all.
Both of these issues mean everyone has to use third-party packages to make up for that, of which there are tons, each with their own issues, breaking changes, upgrades, etc.
[0] https://www.php-fig.org/psr/psr-4/
[1] https://getcomposer.org/
[2] https://packagist.org/
That's not particularly pointed at PHP that. There is a big problem in this industry about where we get our software from and how it's built and managed but that's well outside the topic of this thread. Fundamentally everything is fundamentally broken with dependency management, trust and competence.
Rightfully so. Your comment is utterly toxic.
What this does is create a large community of enthusiastic beginners led by few (prone to follow trends by authoritative members) so you get some experts but a lot of beginners and beginners love libraries, especially ones written by the expert contingent. The JS stdlib is not as strong as it could be, nor is python, so libraries in some cases make a lot of sense but for beginners it is easy to rely on libraries for everything.
Eventually some of these beginners turn into skilled programmers and either stick with just JS or Python, and then the other subset moves on and tries other languages that address some of the perceived 'shortcomings' of JS/Python. What you find is that a lot of the ecosystem becomes that beginner crew and a repeated brain drain of the other 70% who move on.
Comparing the js stdlib with python one tells me you never used python.
Also the theory that experts move on while noobs stay is just a theory. I'm going to assume you personally moved to rust and need to call yourself an expert.
However the average python project has 25 dependencies and the average js has 174 (source https://snyk.io/reports/open-source-security/) so perhaps js and python do not have equivalent stdlib?
EDIT: Turns out Python just finalized a pyproject.toml format in 2021. Of course, this doesn't really help much until every package out there migrates. npm has used the package.json format pretty much since day one. And there is still no standard lockfile, other than dumping the output of `pip freeze`.
It does, with pyproject.toml [1]. It even had two [2], but setup.cfg is deprecated because it was specific to setuptools.
[1] https://setuptools.pypa.io/en/latest/userguide/pyproject_con...
[2] https://setuptools.pypa.io/en/latest/userguide/declarative_c...
Your environment may be consistent at this point in time but it's still a horrible mess.
Now I like NPM.
I feel like so much criticism of NPM comes from either people who've only ever used NPM, or people who haven't used NPM and just saw a big node_modules once.
A common one in work is Java devs criticising the huge node_modules folder but not realising that .m2 exists as their IDE handles it for them "by magic".
JavaScript can go directly to hell.
There’s no easy dependency management system.
Bash - the most interoperable language in existence - contains its own version of malloc because some systems used to need that (back 30 years ago).
JS has an extremely uncertain runtime. Is it in a browser? Engine? PDF?