const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin') const TerserJSPlugin = require('terser-webpack-plugin') const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const {CleanWebpackPlugin} = require('clean-webpack-plugin'); const { VueLoaderPlugin } = require('vue-loader'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { mode: 'production', optimization: { minimizer:[new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})] }, plugins: [ new MiniCssExtractPlugin({ filename: '[id]a.css' }), new HtmlWebpackPlugin({ template: 'public/index.html' }), new VueLoaderPlugin(), new CleanWebpackPlugin({}), ], entry:[ './src/index.js' ], module: { rules: [ { test: /\.js$/, loader: 'babel-loader', options:{ presets: ['@babel/preset-env'] }, }, { test: /\.vue$/, loader: 'vue-loader' }, { test: /\.(sa|sc|c)ss$/, use: [ { loader: MiniCssExtractPlugin.loader, }, 'css-loader', 'sass-loader', ], }, ], }, resolve: { extensions: [ '.vue', '.js' ] }, output: { filename: '[id]a.js', path: path.resolve(__dirname, 'build/prod') }, };