Experimental loaders


注意:此 API 目前正在重新设计,并将继续更改。

要自定义默认的模块解析,则可以选择通过 Node.js 的 --experimental-loader ./loader-name.mjs 参数提供加载器钩子。

当使用钩子时,只适用于 ES 模块加载,而不适用于任何加载的 CommonJS 模块。

Note: This API is currently being redesigned and will still change.

To customize the default module resolution, loader hooks can optionally be provided via a --experimental-loader ./loader-name.mjs argument to Node.js.

When hooks are used they only apply to ES module loading and not to any CommonJS modules loaded.