Open guybedford opened 1 year ago
Ideally one would want to scope the querystring stuff to specific domains / parents though. Eg you likely don't want it for the JSPM CDN, just the local package code... not sure how best to define that part.
Perhaps querystrings is an object configuration:
type QueryStrings: Record<String, String>
where
new Generator({
queryStrings: {
'/': 'timestamp=asdf',
'https://esm.sh/': 'dev'
}
});
Then when processing URLs we would always strip all querystrings, but then add them back at the very end of the import map construction process as a post-processing of the import map, possibly even after the import map has been serialized into JSON. like a const map = importMap.getMap(); const mapWithQueryStrings = postProcess(map)
step.
For cache invalidations, a common pattern is to add query strings -
?q=asdfhjkl
with a random timestamp or hash.When using the generator, we could enable an option to include "querystrings" in the map, something like the following: