Bypass node cache on dynamic import thanks to worker
docs/demo/random_number.mjs
export const randomNumber = Math.random()
docs/demo/demo.mjs
import { importOneExportFromFile } from "@jsenv/dynamic-import-worker"
const randomNumberFileUrl = new URL("./random_number.mjs", import.meta.url)
const randomNumberExportUrl = `${randomNumberFileUrl}#randomNumber`
const randomNumberA = await importOneExportFromFile(randomNumberExportUrl)
const randomNumberB = await importOneExportFromFile(randomNumberExportUrl)
console.log(randomNumberA)
console.log(randomNumberB)
> node ./docs/demo/demo.mjs
0.5362418125287491
0.35129949391010595