| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- const { defineConfig } = require('@vue/cli-service')
- module.exports = defineConfig({
- transpileDependencies: true,
- lintOnSave: false,
- // 生产环境不生成 source map,减小包体积
- productionSourceMap: false,
- devServer: {
- port: 8080,
- open: true,
- proxy: {
- // /dev-api/auth/** → auth 服务
- '/dev-api/auth': {
- target: process.env.VUE_APP_AUTH_TARGET || 'http://localhost:8080',
- changeOrigin: true,
- pathRewrite: { '^/dev-api': '' }
- },
- // /dev-api/laboratory/** → laboratory 服务
- '/dev-api/laboratory': {
- target: process.env.VUE_APP_LAB_TARGET || 'http://localhost:8080',
- changeOrigin: true,
- pathRewrite: { '^/dev-api': '' }
- }
- }
- },
- css: {
- loaderOptions: {
- sass: {
- additionalData: `@import "@/styles/variables.scss";`
- }
- }
- },
- // 按需加载:将第三方库单独分包
- configureWebpack: {
- optimization: {
- splitChunks: {
- chunks: 'all',
- cacheGroups: {
- echarts: {
- name: 'chunk-echarts',
- test: /[\\/]node_modules[\\/]echarts[\\/]/,
- priority: 20
- },
- elementUI: {
- name: 'chunk-element-ui',
- test: /[\\/]node_modules[\\/]element-ui[\\/]/,
- priority: 15
- },
- vendors: {
- name: 'chunk-vendors',
- test: /[\\/]node_modules[\\/]/,
- priority: 10
- }
- }
- }
- }
- }
- })
|