CopyWebpackPlugin 的使用

cnpm install copy-webpack-plugin@4.6.0 --save-dev 
 
const CopyWebpackPlugin = require('copy-webpack-plugin');
 
// 默认复制到dist文件,则不需要加to
new CopyWebpackPlugin([
  { from: 'error.html', flatten: true },
])
 
// 复制到指定位置
new CopyWebpackPlugin([
  { from: 'error.html', to: '/somewhere', flatten: true },
])
 
// 另外注意版本号,可能语法会有所不同
"webpack": "3.8.1",
"copy-webpack-plugin": "^4.6.0",

原文地址:https://www.cnblogs.com/lbx6935/p/14046611.html