3 ms·
Every file? You have one .js file per project, if you're like me. So just throwing those two lines in the top and never having to worry about it ever again seem
by mrweasel 2y ago
Every file? You have one .js file per project, if you're like me. So just throwing those two lines in the top and never having to worry about it ever again seems like a nice option.
- NoahKAndrews 2y agoHow big are your projects? It's very strange to me that you would want to have just a single JS file per project. Even if you want to avoid bundlers, ES modules make it easy to import code from other files.
- mrweasel 2y ago> How big are your projects? In terms of Javascript, as little as I can possibly get away with. The web stuff that I do is mostly CRUD type apps, which can be done entirely server side. The Javascript is only where it make the user experience better, so basic form help or to do a modal, things like that.
- niutech 2y agoImporting an ES module without a bundler involves making a HTTP request, which costs time. Better KISS and fit all of JS in a single script.
- mg 2y agowhich costs time No sure this holds true anymore. When you go to a site like reddit.com which uses HTTP/2, you see a gazillion of requests for JS files, many starting at the same time and ending at the same time. I think that is because newer HTTP versions can put multiple requests in the same data packet. And even HTTP/3 is now supported by over 90% of browsers.