Replies: 2 comments
-
My preferred solution is to simply run the scripts via
You just have to implement the logic of requireUncached yourself. You need to use function requireUncached(id: string) {
clearModule(id);
return require(id);
}
function clearModule(id: string, map = new Map()) {
const module = require.cache[id];
if (module) {
map.set(id, true);
// Clear children modules
module.children.forEach(child => {
if (!map.get(child.id)) {
requireUncached(child.id, map);
}
});
delete require.cache[id];
}
I don't have a use case for this function in the program and have too many dependencies already anyway. My suggestion would be that you just add this locally in the package.json of your project. These dependencies can be resolved directly. Alternative would be to build a separate plugin for it. |
Beta Was this translation helpful? Give feedback.
-
Thanks for outlining the various options. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am wondering if there is an alternative to the removed
requireUncached
to make working with own script-files easier during development.In the docs it says
How can I manually remove a script from the cache?
Is there a chance to include packages like import-fresh to improve the situation?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions