12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 'use strict'
- const webpack = require('webpack')
- const { merge } = require('webpack-merge')
- const baseConfig = require('./webpack.config.base')
- const MiniCssExtractPlugin = require('mini-css-extract-plugin')
- const TerserPlugin = require("terser-webpack-plugin");
- const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
- module.exports = merge(baseConfig, {
- mode: 'production',
- module: {
- rules: [
- {
- test: /\.css?$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: '',
- },
- },
- 'css-loader'
- ]
- }, {
- test: /\.scss?$/,
- use: [
- {
- loader: MiniCssExtractPlugin.loader,
- options: {
- publicPath: '',
- },
- },
- 'css-loader',
- 'sass-loader'
- ]
- }, {
- test: /\.(png|jpg|gif|svg)$/,
- use: [
- {
- loader: 'url-loader',
- options: {
- limit: 5000
- }
- }
- ]
- }
- ]
- },
- optimization: {
- minimize: true,
- minimizer: [
- new TerserPlugin({
- parallel: true,
- test: /\.(js|vue)$/,
- // extractComments: true
- terserOptions: {
- compress: {
- // drop_console: true,
- pure_funcs: [
- 'console.log',
- 'console.info',
- 'console.debug'
- // 'console.warn'
- ]
- },
- },
- })
- ],
- },
- plugins: [
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify('production')
- }),
- new BundleAnalyzerPlugin({
- 'analyzerMode': 'static'
- }),
- ]
- })
|