diff --git a/vue/full/src/config/index.js b/vue/full/src/config/index.js index 261acfe..86178c5 100644 --- a/vue/full/src/config/index.js +++ b/vue/full/src/config/index.js @@ -1,9 +1,6 @@ -const isDev = process.env.NODE_ENV === 'development' -const contextPath = isDev ? '/' : '/jxc-admin/' +const contextPath = process.env.NODE_ENV === 'development' ? '/' : '/jxc-admin/' module.exports = { - isDev, - //项目的部署路径,始终以'/'开头,以'/'结束 contextPath, @@ -20,7 +17,7 @@ module.exports = { useMock: false, //socket连接地址 - socketUrl: isDev ? 'http://localhost:12580' : 'https://toesbieya.cn', + socketUrl: process.env.NODE_ENV === 'development' ? 'http://localhost:12580' : 'https://toesbieya.cn', //路由配置 route: { @@ -40,7 +37,7 @@ module.exports = { storePrefix: 'https://static.toesbieya.cn/', //预览地址前缀 - previewPrefix: isDev ? 'http://localhost:8012' : 'https://preview.toesbieya.cn', + previewPrefix: process.env.NODE_ENV === 'development' ? 'http://localhost:8012' : 'https://preview.toesbieya.cn', }, //本地存储配置 @@ -49,6 +46,6 @@ module.exports = { keyPrefix: 'GCC-', //读写时是否进行压缩的默认值 - zip: !isDev + zip: process.env.NODE_ENV !== 'development' } } diff --git a/vue/full/vue.config.js b/vue/full/vue.config.js index 150d2cb..611e8a9 100644 --- a/vue/full/vue.config.js +++ b/vue/full/vue.config.js @@ -1,6 +1,7 @@ const path = require('path') const settings = require('./src/config') const CompressionWebpackPlugin = require('compression-webpack-plugin') +const isDev = process.env.NODE_ENV === 'development' function resolve(dir) { return path.join(__dirname, dir) @@ -12,7 +13,7 @@ module.exports = { assetsDir: 'static', runtimeCompiler: true, lintOnSave: false, - productionSourceMap: settings.isDev, + productionSourceMap: isDev, transpileDependencies: ['el-admin-layout'], devServer: { port: process.env.port || 8079, @@ -70,7 +71,7 @@ module.exports = { .options({symbolId: 'icon-[name]'}) .end() - config.when(!settings.isDev, config => { + config.when(!isDev, config => { //将css合并到一个文件中 //https://github.com/vuejs/vue-cli/issues/2843 config