output.copy

  • 类型: CopyPluginOptions | CopyPluginOptions['patterns']
  • 默认值: undefined

将指定的文件或目录拷贝到构建输出目录中,基于 rspack.CopyRspackPlugin 实现。

配置项请参考:rspack.CopyRspackPlugin

示例

./src/assets 下的文件拷贝到 ./dist 目录:

export default {
  output: {
    copy: [
      // `./src/assets/image.png` -> `./dist/image.png`
      { from: './src/assets' },
    ],
  },
};

./src/assets 下的文件拷贝到 ./dist/assets 目录:

export default {
  output: {
    copy: [
      // `./src/assets/image.png` -> `./dist/assets/image.png`
      { from: './src/assets', to: 'assets' },
    ],
  },
};
目录