拷貝文件的插件webpack
$ npm install copy-webpack-plugin --save-dev
new CopyWebpackPlugin(patterns: Array, options: Object)
{from: 'path', to: 'path'}
。webpack.config.jsgit
var path = require('path'); var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { entry: path.resolve(__dirname, 'src'), output: { path: path.resolve(__dirname, 'build'), filename: 'app.js' }, context: path.resolve(__dirname, 'src'), plugins: [ new CopyWebpackPlugin([{ from: 'test/test.js', to: 'test' }], { ignore: [], copyUnmodified: true }) ] };
執行命令github
$ webpack