News for hackers. Stuff that matters.
Re:Why we switched from Webpack to Vite by colordrops on Wednesday April 28, 2021 @05:36PM (#26974529)
What about using native es6 imports cached by a service worker? If you don't have to support old browsers, this is a much better option than a compile step. Just pull from git and load it in your browser, no complications eating a weekend reading through docs and shotgun debugging.
Re:Why we switched from Webpack to Vite by gregfagan on Wednesday April 28, 2021 @07:03PM (#26975358)
Can you share more about your setup?
Re:Why we switched from Webpack to Vite by colordrops on Wednesday April 28, 2021 @07:43PM (#26975643)
I can't share code yet but we are working on potentially open sourcing it. We have a no-build policy, so just raw JS. Using an in-house web component framework similar to LitElement. There is a minimal deploy step that creates a manifest that hashes all files in the repo, and the service worker uses this manifest to determine if a file is cached or not, and serves it up if so. Service workers can intercept network requests so they work great for this. The win here is if you change a couple files, only those files need to be downloaded and cached.