node-preload
Request that Node.js child processes preload modules
Install node-preload
This module requires node.js 8 or above.
npm i node-preload
Usage
'use strict';
const nodePreload = require('node-preload');
nodePreload.preloadAppend(require.resolve('@babel/register'));
nodePreload.propagateEnv.TEST1 = 'value1';
preloadAppend(filename)
Append filename
to the list of modules to be preloaded.
If filename
is already in the list it will be moved to the end.
preloadInsert(filename)
Insert filename
to the list of modules to be preloaded.
If filename
is already in the list it will be moved to the beginning.
preloadRemove(filename)
Remove filename
from the list of modules to be preloaded.
preloadGetList()
Retrieve an array listing the current filenames to be preloaded.
propagateEnv
Similar to process.env
but controls environmental variables to be propagated
to child processes.
Running tests
Tests are provided by xo and ava.
npm install
npm test