graaljs icon indicating copy to clipboard operation
graaljs copied to clipboard

About builtin commonjs cache

Open tellmewhattodo opened this issue 2 years ago • 3 comments

unlike node.js, when I use Context with CommonJS enabled, require.cache is not defined.

I noticed that cjs cache is actually here: com.oracle.truffle.js.runtime.JSRealm#commonJSRequireCache

but can't find a decent way to remove or clear it. if there is an approach to clear it , I'd like to know it. If there isn't, could this feature be added to graaljs-cjs?

tellmewhattodo avatar Sep 15 '22 05:09 tellmewhattodo

anyone noticed me?

tellmewhattodo avatar Sep 19 '22 09:09 tellmewhattodo

Hi, Thank you for reaching out, I'll check with the JS team about this and get back to you

oubidar-Abderrahim avatar Sep 20 '22 13:09 oubidar-Abderrahim

no, we don't support require.cache in our implementation, and commonJSRequireCache is internal. There are no plans to add support for require.cache in the near future (as far as I know) and our commonjs emulation is not 100% compatible with node.js

I've created a feature request to add support to this. Tracked internally at GR 41317

oubidar-Abderrahim avatar Sep 23 '22 10:09 oubidar-Abderrahim

We currently have no plans to add support for this, sorry.

woess avatar Nov 07 '22 14:11 woess