This loader overloads the fs
module specifier to point to a new version with a different readFile
implementation as an example for how to create tooling like APMs or mocking in ESM using loader hooks.
This loader can be used by passing in the --loader
flag to node
.
node --experimental-modules --loader ./index.mjs $MAIN
or
NODE_OPTIONS='--experimental-modules --loader ./index.mjs'
node $MAIN