const { defineConfig } = require('@vue/cli-service') const path = require('path') function resolve(dir) { return path.join(__dirname, dir) } module.exports = defineConfig({ // devServer: { // //请求服务器的地址 // proxy: 'https://forum.gter.net' // }, // devServer: { // publicPath: './' // }, transpileDependencies: true, // publicPath: process.env.NODE_ENV === 'production' ? './' : '/', // publicPath: './', publicPath: process.env.NODE_ENV === 'production' ? "https://x-cloud-project.oss-cn-guangzhou.aliyuncs.com/forum" : '/', configureWebpack: { optimization: { splitChunks: { chunks: 'all', minSize: 20000, maxSize: 50000, minChunks: 1, maxAsyncRequests: 30, maxInitialRequests: 30, automaticNameDelimiter: '~', enforceSizeThreshold: 50000, cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, priority: -10, filename: 'js/chunk-vendors.[contenthash].js', }, }, }, }, resolve: { alias: { 'assets': '@/assets', 'common': '@/common', 'components': '@/components', 'network': '@/network', 'views': '@/views' } }, // plugins: [ // new BundleAnalyzerPl/ugin(), // ], }, // svg图片配置 lintOnSave: false, chainWebpack(config) { config.module .rule('svg') .exclude.add(resolve('src/icons')) //svg的存储地址 .end() config.module .rule('icons') .test(/\.svg$/) .include.add(resolve('src/icons')) //svg的存储地址 .end() .use('svg-sprite-loader') .loader('svg-sprite-loader') .options({ symbolId: 'icon-[name]' }) .end() }, productionSourceMap: false, })