17

ES Modules docs states:

require.cache is not used by import. It has a separate cache.

So where's this separate cache? Is it accessible after all?

I'm looking for invalidating module caching as it can be done in CommonJS modules (node.js require() cache - possible to invalidate?)

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206

1 Answers1

2

I saw your thread on the nodeJS github and your answer is there: the cache is designed to be immutable. There's also a good suggestion to use Workers, with each instance having its own fresh imports. Short of that, if you need this behaviour (which doesn't exist for a reason), is there perhaps a better way to design your application to not need it?

EDIT: The issue on GH: https://github.com/nodejs/help/issues/1399