123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- // var webpack = require("webpack");
- var TerserPlugin = require("terser-webpack-plugin");
- var CompressionPlugin = require("compression-webpack-plugin");
- var devProxy = {
- "/api/": {
- target: process.env.VUE_APP_DEV_PROXY,
- changeOrigin: true
- }
- };
- // 配置手册: https://cli.vuejs.org/zh/config/#vue-config-js
- var config = {
- // publicPath: './',
- productionSourceMap: false,
- devServer: {
- port: 8076,
- proxy: devProxy
- },
- transpileDependencies: ["vue-echarts", "resize-detector"],
- chainWebpack: config => {
- // webpack-chain配置手册:github.com/neutrinojs/webpack-chain#getting-started
- // config.plugin("provide").use(webpack.ProvidePlugin, [
- // {
- // "window.Quill": "quill/dist/quill.js",
- // Quill: "quill/dist/quill.js"
- // }
- // ]);
- }
- };
- // compress配置手册:https://github.com/mishoo/UglifyJS2/tree/harmony#compress-options
- if (process.env.NODE_ENV === "production") {
- config.configureWebpack = {
- plugins: [
- // gzip
- new CompressionPlugin({
- filename: "[path].gz[query]",
- algorithm: "gzip",
- test: new RegExp("\\.(js|css)$"),
- threshold: 10240,
- minRatio: 0.8
- })
- ],
- optimization: {
- minimizer: [
- new TerserPlugin({
- terserOptions: { compress: { drop_console: true } }
- })
- ]
- }
- };
- }
- // 解决iview自定义主题导入less报错
- config.css = {
- loaderOptions: {
- less: {
- javascriptEnabled: true
- }
- }
- };
- module.exports = config;
|