47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
const { merge } = require('webpack-merge')
|
||
const baseConfig = require('./webpack.base.js')
|
||
const TerserPlugin = require("terser-webpack-plugin");
|
||
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||
|
||
// const VITE_BASE_URL = 'http://192.168.110.126:8099'; // 樊波
|
||
const VITE_BASE_URL = 'http://120.55.12.245:8098'; // 测试-公网
|
||
// const VITE_BASE_URL = 'https://scens.admin.86698.cn'; // 正式地址
|
||
|
||
// 合并公共配置,并添加开发环境配置
|
||
module.exports = merge(baseConfig, {
|
||
mode: 'development', // 开发模式,打包更加快速,省了代码优化步骤
|
||
devtool: 'eval-cheap-module-source-map', // 源码调试模式
|
||
optimization: {
|
||
minimize: true,
|
||
minimizer: [
|
||
new TerserPlugin({
|
||
terserOptions: {
|
||
compress: {
|
||
// drop_console: true, // 移除所有的`console`语句
|
||
},
|
||
output: {
|
||
// comments: false, // 去掉注释
|
||
},
|
||
},
|
||
// extractComments: false, // 不从代码中提取注释
|
||
}),
|
||
new CssMinimizerPlugin(),
|
||
],
|
||
},
|
||
devServer: {
|
||
port: 8888, // 服务端口号
|
||
compress: false, // gzip压缩,开发环境不开启,提升热更新速度
|
||
hot: true, // 开启热更新,后面会讲vue3模块热替换具体配置
|
||
historyApiFallback: true, // 解决history路由404问题
|
||
open: true, // 服务启动时是否自动打开浏览器
|
||
proxy: [
|
||
{
|
||
context: ['/api'],
|
||
target: VITE_BASE_URL,
|
||
changeOrigin: true,
|
||
secure: false,
|
||
pathRewrite: { '^/api': '' },
|
||
},
|
||
],
|
||
}
|
||
}) |