I do wonder how modular css fits into the picture of es modules though.
I do wonder how modular css fits into the picture of es modules though.
I think the reason it is like that is because there were many problems with JS "back in the day", and so people felt they had to come up with solutions.
Just look at Svelte. It's a library about compiling JS to get back to the "just JS" days. I mean, it's more than that, but it's about reducing runtime complexity. So another way to think about it is that writing "old style simple JS" is so convoluted that the author felt the need to write a translation layer from modern frameworks to old style JS. Sort of a mindblower to me haha (though, I love and agree with Svelte, to be clear).
The great thing though is that you can still use plain old JS, right? Nothing has changed for you if you don't want it. So is there really a problem?
This "modern web" stuff is just people solving problems. Some of these problems are the fault of old JS/web. Some of them are problems of our own making. Remember how amazing modern UI frameworks were? It's because we had PTSD from horrible jQuery codebases. A problem of our own making.
So stick with what you like, and other people can use the more complex stuff. It's a win win, no?
But it's perfectly possible to write a modern PWA using modern js, modules, and a library like react (loaded from a cdn) without any build step at all. I've done it, and it's not all that hard as long as you don't mind only targeting the latest browsers (and writing out a bunch of file names manually).
But I still like:
https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool...
And the accompanying example repo:
https://github.com/keithamus/npm-scripts-example
I'm not eniterly clear on what parcel/webpack does better/simpler - maybe windows support?
I certainly see how one might prefer yarn over npm for dependency management, though - so maybe npm isn't as nice a build tool anymore?
Parcel does seem nice, because it does do a lot of things automatically. But I'm not sure that can always be "the right thing". For example it seems a bit surprising that plain js will always be compiled, to support ie11, while typescript will not.
Neither option is "always the right thing".
And as far as I could figure out, there's no easy way to target deploying to separate cdns?
Not trying to move the goal posts here, it's just that some configuration is to expected in the complex reality of the modern web stack.
And a benefit of npm is that that'll pretty much always be part of the stack anyway.
Did come across this, which (if it isn't outdated) fills in some information that wasn't obvious from the official documentation:
https://golb.hplar.ch/2018/01/Bundling-web-applications-with...
I don't care much about typescript or ie11, but if there are specific improvements that could be made you could open a PR.
I don't think parcel concerns itself with deploying to separate CDNs. You can do that in npm! Does anything need to be built differently to support that? Maybe just keep files bound for different CDNs in different directories?
[0] https://parceljs.org/cli.html#set-the-public-url-to-serve-on
But you can, if you build the project and then serve the "build" directory.
If that's the step that's bothering you, you can just not use Webpack, that's completely possible for all major libraries I encountered.
ES modules could also bring sanity to dependency management within the ecosystem. It is interesting to see the approach Deno JS is taking here as well.
Is the JS world trending away from Webpack now? When did this happen?
Webpack's complexity seems born out of necessity since back in the day a lot of things were just not there.
Parcel has no baggage and it shows in it's very lean offering that works without you needing to troll through stackoverflow, old github issues and forum links.
I've never understood why webpack got so much attention either. Both rollup and webpack are much slower than browserify, so I just keep using browserify. And I can get tree shaking with browserify by using a plugin too!