加载器


\Loaders

版本历史
版本变更
v16.17.0

添加对链接加载器的支持。

v16.12.0

删除了 getFormatgetSourcetransformSourceglobalPreload;添加了 load 钩子和 getGlobalPreload 钩子。

v8.8.0

新增于: v8.8.0

稳定性: 1 - 实验性的

\Stability: 1 - Experimental

此 API 目前正在重新设计,并且仍会发生变化。

\This API is currently being redesigned and will still change.

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

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

使用钩子时,它们适用于入口点和所有 import 调用。它们不适用于 require 调用;那些仍然遵循 CommonJS 规则。

\When hooks are used they apply to the entry point and all import calls. They won't apply to require calls; those still follow CommonJS rules.

加载器遵循 --require 的模式:

\Loaders follow the pattern of --require:

node \
 --experimental-loader unpkg \
 --experimental-loader http-to-https \
 --experimental-loader cache-buster 

它们按以下顺序调用:cache-buster 调用 http-to-https,http-to-https 调用 unpkg

\These are called in the following sequence: cache-buster calls http-to-https which calls unpkg.

AltStyle によって変換されたページ (->オリジナル) /