| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- const { defineConfig } = require('@vue/cli-service')
- const webpack = require('webpack')
- module.exports = defineConfig({
- transpileDependencies: true,
- lintOnSave: false,
- productionSourceMap: false,
- publicPath: './',
- devServer: {
- port: 8080,
- open: true,
- proxy: {
- '/auth': {
- target: process.env.VUE_APP_BASE_API,
- changeOrigin: true,
- pathRewrite: { '^/auth': '/auth' }
- },
- '/laboratory': {
- target: process.env.VUE_APP_BASE_API,
- changeOrigin: true,
- pathRewrite: { '^/laboratory': '/laboratory' }
- }
- }
- },
- 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: {
- plugins: [
- new webpack.ProvidePlugin({
- Buffer: ['buffer', 'Buffer'],
- process: 'process/browser'
- })
- ],
- resolve: {
- fallback: {
- url: require.resolve('url/'),
- buffer: require.resolve('buffer/'),
- process: require.resolve('process/browser')
- }
- },
- 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
- }
- }
- }
- }
- }
- })
|