chore: 添加 Debug 功能

This commit is contained in:
hz
2025-10-17 10:20:23 +08:00
parent cf9ec8146c
commit 704059a0b6

View File

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