const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ transpileDependencies: true, lintOnSave:false, publicPath: "./", // 公共路径(必须有的) outputDir: "bigData", // 输出文件目录 assetsDir: "static", //静态资源文件名称 productionSourceMap: false, //去除打包后js的map文件 devServer: { host: "localhost", // 默认是localhost port: 8081, // 前端项目编译后使用的端口号,跟webpack配置的port同理 open:true, proxy: { '/api': { target: `http://localhost:8081`, // 实际跨域请求的API地址 changeOrigin: true, // 跨域 // 请求地址重写 http://front-end/api/login ⇒ http://api-url/login pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' } } }, }, chainWebpack(config) { config .when(process.env.VUE_APP_ENV !== 'www.dlc.com', config => { config .plugin('ScriptExtHtmlWebpackPlugin') .after('html') .use('script-ext-html-webpack-plugin', [{ // `runtime` must same as runtimeChunk name. default is `runtime` inline: /runtime\..*\.js$/ }]) .end() config .optimization.splitChunks({ chunks: 'all', minSize: 50000, //构建出来的chunk大于30000才会被分割 maxSize: 100000, //会尝试根据这个大小进行代码分割 }) } ) }, })