| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- const { defineConfig } = require('@vue/cli-service')
- module.exports = defineConfig({
- transpileDependencies: true,
- lintOnSave: false,
- productionSourceMap: false,
- devServer: {
- port: 8080,
- open: true,
- proxy: {
- '/api': {
- target: process.env.VUE_APP_BASE_API,
- changeOrigin: true,
- pathRewrite: { '^/api': '' }
- }
- }
- },
- css: {
- loaderOptions: {
- sass: {
- additionalData: `@import "@/styles/variables.scss";`
- }
- }
- },
- chainWebpack(config) {
- // 页面标题
- config.plugin('html').tap(args => {
- args[0].title = process.env.VUE_APP_TITLE || '实验室安全智慧化管控中心'
- return args
- })
- },
- configureWebpack: {
- optimization: {
- splitChunks: {
- chunks: 'all',
- cacheGroups: {
- // Vue 全家桶
- vue: {
- name: 'chunk-vue',
- test: /[\\/]node_modules[\\/](vue|vue-router|vuex)[\\/]/,
- priority: 30
- },
- // ECharts 单独拆包(体积最大)
- echarts: {
- name: 'chunk-echarts',
- test: /[\\/]node_modules[\\/](echarts|zrender)[\\/]/,
- priority: 25
- },
- // Element UI
- elementUI: {
- name: 'chunk-element-ui',
- test: /[\\/]node_modules[\\/]element-ui[\\/]/,
- priority: 20
- },
- // 其余第三方
- vendors: {
- name: 'chunk-vendors',
- test: /[\\/]node_modules[\\/]/,
- priority: 10,
- reuseExistingChunk: true
- }
- }
- }
- }
- }
- })
|