UNPKG

vue-flash-message

Version:
65 lines (62 loc) 2.11 kB
'use strict' const path = require('path'); const utils = require('./utils'); const webpack = require('webpack'); const config = require('../config'); const merge = require('webpack-merge'); const baseWebpackConfig = require('./webpack.base.conf'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin'); process.env.NODE_ENV = 'production'; module.exports = merge(baseWebpackConfig, { mode: 'production', entry: [ './dev/main.js' ], output: { path: path.resolve(__dirname, '../example'), publicPath: '', filename: utils.assetsPath('[name].js'), chunkFilename: utils.assetsPath('[id].js') }, plugins: [ // extract css into its own file new MiniCssExtractPlugin({ filename: utils.assetsPath('css/[name].css') }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. new OptimizeCSSPlugin({ cssProcessorOptions: { safe: true } }), // generate dist index.html with correct asset hash for caching. // you can customize output by editing /index.html // see https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ filename: 'index.html', template: 'dev/index.html', minify: { removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true // more options: // https://github.com/kangax/html-minifier#options-quick-reference }, // necessary to consistently work with multiple chunks via CommonsChunkPlugin chunksSortMode: 'dependency' }), // keep module.id stable when vender modules does not change new webpack.HashedModuleIdsPlugin(), new CopyWebpackPlugin([ { from: path.resolve(__dirname, '../static'), to: config.build.assetsSubDirectory, ignore: ['.*'] } ]) ] });