Live data from Hacker News

Today’s JavaScript, from an outsider’s perspective (2020)

lea.verou.me

31–40 of 391 posts

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#31
sounds like the same experience I have with pretty much every language I'm not used to.

I just want to try this C++, download, unzip, oh it's windows so .project file. Fine, redo on windows , oh it's 3 versions of vstuido old and says it wants to upgrade , okay. Hmm errors. Try to fix. Now it's getting linking error.

repeat the same with xcode and any project in c, c++, objc, swift

okay how about ruby? oh I have old ruby , hmmm , try to install new ruby, seems to run, but it can't find certain gems or something. oh and this other ruby thing I was using is now broken ? why do I have to install this stuff globally? You don't but there are several magic spells you must execute and runes you must set in the rigtt places. Oh ... I think I got that setup but it getting this new error.

....

I'm sypathetic it sucks but it's not unique to js

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#32
post #4

Chances are, the only thing interesting from that package is a single source file, which you could just copy over to your project.

I feel like the point of the article isn't so much "how do I solve this specific issue" as "this is the general state of JS packaging", and the solution you present doesn't work in the general case of larger, less trivial dependencies

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#33
post #30
post #15

Earlier quoted context omitted.

I use JS/TS every day. I tried to understand the intricacies in module/import issues. Just reading about it gave me a headache, and tempted me to just rewrite my entire project in Rust. I'm still tempted some days. It's beyond painful. It's infuriating.

It is not going to convince you that ESM modules are well designed... but this post explain a lot of the intricacies https://jakearchibald.com/2021/export-default-thing-vs-thing...

I read halfway through before my brain shutoff. I keep asking myself if all this complexity is necessary.

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#34

I always go into these things hoping the outsider will be an Amish farmer or professional welder, but it always turns out to be just another programmer.

I know a construction worker, a recruiter and a mechanical Engineer, among other random professions, that moved to JS without much trouble. It somehow seems overwhelmingly that it's other fellow devs that have trouble with getting started JS.

TBF right now JS is in transition from commonjs to ESM, and we all believe for the better, but this transition period does yield some strange issues like the article said, for instance I hope/expect that "Warning: To load an ES module [...]" will be default in the near future so we won't need that warning anymore.

Also knowing JS enough, if I see "SyntaxError: Cannot use import statement outside a module" coming from a package I'd know that the package is wrong, at which point I would just try to find other of the 2M+ packages, open the JS file to see how it works if I'm really interested, open an issue or assume the project is just broken (which just happens, not all packages are well built).

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#35

Module resolution is quite a mess in JS at the moment. With the steady move to ESM, hopefully things will get better soon. In this transition period, it's painful. Even for those that deal with JS everyday, most don't actually understand the intricacies of CommonJS & ESM.

Is there a steady move to ESM within the node (rather than browser) ecosystem? Because it seems that CommonJS is used for new projects by major companies.

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#36
post #28

I always go into these things hoping the outsider will be an Amish farmer or professional welder, but it always turns out to be just another programmer.

in what scenario an amish farmer, a professional welder, or, well, anything but a programmer, would know anything about this "javascript" thing?

You would be suprized.

I know a few people whom keep up on tech trends, even though it has nothing to do with their job.

I follow programming trends, basically through HN, and self study. (I have wasted a lot of money on programming/Computing books.), and I'm basically a Jack of all Trades in life.

I'm a mechanic certain years. I'm a contractor certain years. I'm a Electrician when I am very low on money. I'm a Watchmaker whenever someone asks me what I do. (I hate that last sociatial question. When did it become copacetic to ask for job status, and finances. I guess it came with the Selfie. (I didn't use a question mark on purpose. Too disenfranchised today to care.)

I do miss the days before relying on bloated JS libraries.

I miss the LAMP days for my personal websites.

There was a free server I used to use, but forget it's name.

It allowed full domain names without their branding. Like mysite.com, instead of mysite.com.branding.

I know Git, Google, and Amazon offer a free page, but I just don't like learning their way of putting up a site.

As you can by my verbage, I'm not a professional.

But for some reason I try to stay current on certain aspects of this industry.

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#37

Basically: How it feels to learn JavaScript in 2016 https://hackernoon.com/how-it-feels-to-learn-javascript-in-2... Original old-man-railing-at-modern-tech parody: https://circleci.com/blog/its-the-future/

That old-man-railing-at-modern-tech parody was a great read

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#38

Module resolution is quite a mess in JS at the moment. With the steady move to ESM, hopefully things will get better soon. In this transition period, it's painful. Even for those that deal with JS everyday, most don't actually understand the intricacies of CommonJS & ESM.

The compatibily issues with NodeJS dependencies (aka CommonJS modules) and ES6 modules is one of the most painful parts of Javascript today. But at the same time, I wonder if it could have been avoided. Afaik NodeJS was pioneering dependency management at the time, and all modern dependency systems (ES6, Python PipEnv, Go modules, Rust Cargo) drew inspiration from it. So it's understandable that NPM made some mistakes in the beginning

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#39

All he had to do was run `node index.mjs` or `npm run start` to have his index recognized as a module. Node DOES not read package.json, npm (node package manager) does. Node is not the package manager, so of course changes to package.json won't affect running `node index.js` However, node recognizes the file extension mjs as a module and will execute it as such. So renaming the extension of the script would work. Alt…

> Node DOES not read package.json

It does when you use ESM, it checks whether there's "type": "module" in package.json.

Re: Today’s JavaScript, from an outsider’s perspective (2020)

#40
post #31

sounds like the same experience I have with pretty much every language I'm not used to. I just want to try this C++, download, unzip, oh it's windows so .project file. Fine, redo on windows , oh it's 3 versions of vstuido old and says it wants to upgrade , okay. Hmm errors. Try to fix. Now it's getting linking error. repeat the same with xcode and any project in c, c++, objc, swift okay how about ruby? oh I have old…

Stacks being nonfunctional on install is a failure not progress
Post reply on HN