//生产环境配置 const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); //清除文件夹 const CopyWebpackPlugin = require('copy-webpack-plugin'); //复制文件 module.exports = { mode: 'production', output: { path: path.resolve(__dirname, './../dist'), filename: 'js/[name].min.js' }, plugins: [ new CleanWebpackPlugin(), new CopyWebpackPlugin([{ from: 'src/U', to: 'U' }]), new HtmlWebpackPlugin({ template: 'index.html', BASE_URL: 'U/' }), new VueLoaderPlugin() ] }