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

I’ve been writing JS my entire career and never wrote a package.json file. I’m not sure what tool would even use it.

But then again, I’m a happy, sane person who only writes client-side JS.



> I’m a happy, sane person who only writes client-side JS.

I've never written backend javascript. I've used and fought all the tools mentioned


how do you manage large projects?

what happens if your project has tens or even hundreds files, how do you get that to client without any sort of bundler?


Why would the project have hundreds of JS files? Usually I might have something like main.js which handles universal page elements like the search bar in a site-wide navbar, then, if necessary, a few this-specific-page.js files which handles elements which are specific to this page or site section. If any libraries are needed, try first to just link them in using CDNJS or the like, so no need to store them locally or bundle them in our own scripts - I know there are downsides to relying on external CDNs for such things but in practice it just works. Easy peasy.

But first, I try to avoid using JavaScript in the first place when not strictly necessary. This means server-side rendering as much as possible rather than doing the glacial "load an almost entirely blank page, load giant JS blobs, then load the page content via AJAX and hope that nothing goes wrong in that process, sorry slow connection users, non-standard browser users, and search engine bots" approach which thankfully is finally starting to see some pushback.


Here's what the person you're responding to said:

> I’ve been writing JS my entire career and never wrote a package.json

And you replied:

> how do you get that to client without any sort of bundler?

Please connect the dots for me.




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

Search: