From ffd7c9797f5d19a916faede5c58e867b2c5ca967 Mon Sep 17 00:00:00 2001 From: program-walker <418875866@qq.com> Date: Mon, 12 Oct 2020 18:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=85=E5=8F=91=E5=B8=83=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=85=8D=E7=BD=AE=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue.config.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vue.config.js b/vue.config.js index 73f199c82..69f00e241 100644 --- a/vue.config.js +++ b/vue.config.js @@ -12,6 +12,13 @@ const webpack = require('webpack'); const name = defaultSettings.title; // page title const port = 9527; // dev port +let publicPath = ''; +let outputDir = ''; +(function () { + publicPath = process.env.VUE_APP_PRO == 'local' ? '/' : '/cbtc'; + outputDir = process.env.VUE_APP_PRO == 'local' ? 'dist' : 'dist/cbtc'; +})(); + // All configuration item explanations can be find in https://cli.vuejs.org/config/ module.exports = { /** @@ -21,8 +28,8 @@ module.exports = { * In most cases please use '/' !!! * Detail: https://cli.vuejs.org/config/#publicpath */ - publicPath: '/cbtc', - outputDir: 'dist/cbtc', + publicPath: publicPath, + outputDir: outputDir, assetsDir: 'static', // 相对于outputDir的静态资源(js、css、img、fonts)目录 lintOnSave: false, productionSourceMap: false, // 项目打包后是否压缩