Scripts/Modules running in the context created with vm.createContext can not access various Node.js built-in apis/modules like URL, node:assert, node:http, etc. This makes it cumbersome to create a disposable context for use cases like hot-module-reload to run existing node.js apps.
We can provide a built-in API to create a context (or a new NodeRealm for compatibility) with full-fledged Node.js built-in modules support. It allows object exchanges between realms and shares the same loop with the main context.
, similar to the existing vm.context.
/cc @mcollina @nodejs/realm @nodejs/vm
Scripts/Modules running in the context created with
vm.createContextcan not access various Node.js built-in apis/modules likeURL,node:assert,node:http, etc. This makes it cumbersome to create a disposable context for use cases like hot-module-reload to run existing node.js apps.We can provide a built-in API to create a
context(or a newNodeRealmfor compatibility) with full-fledged Node.js built-in modules support. It allows object exchanges between realms and shares the same loop with the main context., similar to the existing
vm.context./cc @mcollina @nodejs/realm @nodejs/vm