1.安装插件copy-webpack-plugin
npm install copy-webpack-plugin --save-dev
2.在build/webpack.base.conf.js文件下使用插件,例如将目录doc打包到dist下与index.html同级目录下
plugins: [
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../doc'),
to: 'doc',
ignore: ['.*']
}
])
]
3.打包前将doc目录放在与static同级目录下,执行打包命令,就可以将doc打包到dist并且与index.html目录下了
打包前的工程目录:
打包后的前端包