1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- '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");
- module.exports = merge(baseConfig, {
- mode: 'production',
- module: {
- rules: [
- {
- test: /\.css?$/,
- use: [
- MiniCssExtractPlugin.loader,
- 'css-loader'
- ]
- }, {
- test: /\.scss?$/,
- use: [
- MiniCssExtractPlugin.loader,
- 'css-loader',
- 'sass-loader'
- ]
- }, {
- test: /\.(png|jpg|gif)$/,
- 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')
- })
- ]
- })
|