diff --git a/vue.config.js b/vue.config.js index 7db66c514..57320bf6a 100644 --- a/vue.config.js +++ b/vue.config.js @@ -8,7 +8,7 @@ */ const autoprefixer = require('autoprefixer') const pxtoviewport = require('postcss-px-to-viewport') -const TerserPlugin = require("terser-webpack-plugin"); +const TerserPlugin = require('terser-webpack-plugin') module.exports = { publicPath: process.env.NODE_ENV === 'production' ? '/' : '/', @@ -16,6 +16,7 @@ module.exports = { outputDir: 'dist', //打包输出目录 productionSourceMap: true, css: { + sourceMap: true, loaderOptions: { postcss: { plugins: [ @@ -31,15 +32,15 @@ module.exports = { } }, chainWebpack: config => { - const { codeInspectorPlugin } = require('code-inspector-plugin'); + const { codeInspectorPlugin } = require('code-inspector-plugin') config.plugin('code-inspector-plugin').use( codeInspectorPlugin({ bundler: 'webpack', - editor: "webstorm" + editor: 'webstorm' }) - ); - + ) + // 移除 prefetch 插件 config.plugins.delete('prefetch') // // 压缩代码 @@ -52,8 +53,9 @@ module.exports = { devServer: { port: 8082 }, - configureWebpack: { - optimization: { + configureWebpack: config => { + config.devtool = 'source-map' + config.optimization = { minimizer: [ new TerserPlugin({ terserOptions: { @@ -65,5 +67,5 @@ module.exports = { }) ] } - }, + } }