You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
varModule=require('module');functionrequireFromString(src,filename){varm=newModule(filename,null);m._compile(src,filename);m.loaded=true;m.filename=filename;returnm;}console.log(requireFromString('module.exports = { test: 1}','<some-uuid>'));constx=require('<some-uuid>');// this will throw an errorconsole.log(x);console.log('cache:',require.cache);
Activity
ORESoftware commentedon Nov 22, 2018
good question, not sure if it's necessary. I checked the require cache:
and I don't see it in there. I think it will only be in the cache if you load the module with require(). But in this case we aren't using require.
ORESoftware commentedon Nov 22, 2018
as a simple example: