新增npmrc以及yarnrc文件,修改config配置变成可配置的cdn加载以及端口设置

This commit is contained in:
lemon橪
2021-12-21 16:30:54 +08:00
parent 9742aaf0bc
commit b3e6eb72eb
21 changed files with 81 additions and 83 deletions

View File

@@ -11,8 +11,8 @@ const configs = require('./src/config')
* 将开发环境中替换为本地的内容方便处理bug以及开启vueDev
* 我们可以根据环境变量进行相应的处理只有在产品的时候才让插件去自动注入相应的资源文件到html页面
*/
// const enableProduction = process.env.NODE_ENV === "production"; // 是否生产环境
const enableProduction = false // 统一取消cdn加载 目前cdn链接的https请求挂了
const enableProduction = process.env.NODE_ENV === "production"; // 是否生产环境
let externals = {
vue: "Vue",
@@ -54,8 +54,8 @@ let jsPlugin = [
})
];
// 判断是否需要加载CDN
cdn = enableProduction ? cdn : { css: [], js: [] };
externals = enableProduction ? externals : {};
cdn = enableProduction && configs.enableCDN ? cdn : { css: [], js: [] };
externals = enableProduction && configs.enableCDN ? externals : {};
jsPlugin = enableProduction ? jsPlugin : [];
module.exports = {
@@ -81,7 +81,7 @@ module.exports = {
}
},
devServer: {
port: 10000
port: configs.port
},
// 打包时不生成.map文件 避免看到源码