Skip to content

Dynamic module import #1050

@dbauszus-glx

Description

@dbauszus-glx

It shouldn't be required to install node module per instance. Rarely required modules like SAML should be imported on demand.

There are a couple of experimental flags which can make this happen. These are subject to change hence we will have to wait for a future node release where these features become stable.

--experimental-network-imports

Importing network based modules using https: and http: is supported under the --experimental-network-imports flag. This allows web browser-like imports to work in Node.js with a few differences due to application stability and security concerns that are different when running in a privileged environment instead of a browser sandbox.

--experimental-vm-modules

The vm.Module class provides a low-level interface for using ECMAScript modules in VM contexts. It is the counterpart of the vm.Script class that closely mirrors Module Records as defined in the ECMAScript specification.

Unlike vm.Script however, every vm.Module object is bound to a context from its creation. Operations on vm.Module objects are intrinsically asynchronous, in contrast with the synchronous nature of vm.Script objects. The use of 'async' functions can help with manipulating vm.Module objects.

Metadata

Metadata

Labels

FeatureNew feature requests or changes to the behaviour or look of existing application features.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions