I did a write up of how I use import maps to avoid bundling JS on my static site and cache modules more effectively. I mostly use JS for little experiments and generative art and such, so I have a number of utility modules. These get hashed and the names of each resolved in the import map. Original modules are kept for browsers without import map support (without the immutable cache header).
There are a few gotchas. The browser won't use the import map to result an entry point in a script tag for example. Content security policy is a painful one too for static sites like mine (the import map counts as a script, so you have to hash the map and put that in the CSP header).
There are a few gotchas. The browser won't use the import map to result an entry point in a script tag for example. Content security policy is a painful one too for static sites like mine (the import map counts as a script, so you have to hash the map and put that in the CSP header).
https://qubyte.codes/blog/progressively-enhanced-caching-of-...