Open tpluscode opened 4 years ago
I think I ran into a simmilar problem. I needed to clear some earlier required modules to be able to freshly riquire them at runtime. As soon as esm
is initialized I will always get an cached module.
I tried:
process.env.ESM_DISABLE_CACHE = true
require = require('esm')(module, { cache: false, cjs: { cache: false }, force: true })
If I test it without esm
or @babel/register
everythings works as expected and I will be able to freshly require modules.
I am consuming packages which have a ESM-powered commonjs main module.
Problem is that when I update to a new version, the cache is not cleared and ESM stubbornly runs the cached code from the previously installed version.
Setting the no-cache environment variable or
package.json
options does not work. Only nuking thenode_modules/esm/node_modules/.cache
helpsRelated to #805?