For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/plugins/webpack/node-template-plugin.md.
close

NodeTemplatePlugin

此插件用于打包 Node.js 产物,经常配合 childCompiler 一起使用。

它会应用 'commonjs' chunk format,并为 Node.js 运行时配置 output.chunkLoading

默认情况下,它会将 output.chunkLoading 设为 'require'。当启用 asyncChunkLoading 时,则会改为 'async-node'

new rspack.node.NodeTemplatePlugin();

选项

asyncChunkLoading

  • 类型:boolean
  • 默认值:false

为异步 chunk 使用 'async-node' 加载 chunks,而不是 'require'