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

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

5
buyer/.npmrc Normal file
View File

@ -0,0 +1,5 @@
# 默认依赖包指定淘宝源
registry=https://registry.npm.taobao.org/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/

5
buyer/.yarnrc Normal file
View File

@ -0,0 +1,5 @@
registry "https://registry.npmmirror.com"
sass_binary_site "https://npmmirror.com/mirrors/node-sass"
phantomjs_cdnurl "https://npmmirror.com/mirrors/phantomjs"
electron_mirror "https://npmmirror.com/mirrors/electron"

View File

@ -1,30 +1,12 @@
module.exports = { module.exports = {
/** title: "lili-shop", //配置显示在浏览器标签的title、底部信息、部分信息展示的值
* @description 配置显示在浏览器标签的title底部信息部分信息展示的值 icpCard: "", // icp证
*/
title: "lili-shop",
/**
* @description icp证
*/
icpCard: "",
company: { company: {
href: "https://pickmall.cn", href: "https://pickmall.cn",
name:"北京宏业汇成科技有限公司" name: "北京宏业汇成科技有限公司",
}, }, //公司信息
/** icpMessage: "京ICP备20009696号-1", //icp备案
* @description icp备案号 aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key
*/ enableCDN: true, //生产环境 是否启用cdn加载 vue等js
icpMessage: "京ICP备20009696号-1", port:10000, //端口
/**
* @description 是否使用国际化默认为false
* 如果不使用则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'}
* 用来在菜单中显示文字
*/
useI18n: false,
/**
* @description 高德web端申请的api key
*/
aMapKey: "b440952723253aa9fe483e698057bf7d",
}; };

View File

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

5
manager/.npmrc Normal file
View File

@ -0,0 +1,5 @@
# 默认依赖包指定淘宝源
registry=https://registry.npm.taobao.org/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/

5
manager/.yarnrc Normal file
View File

@ -0,0 +1,5 @@
registry "https://registry.npmmirror.com"
sass_binary_site "https://npmmirror.com/mirrors/node-sass"
phantomjs_cdnurl "https://npmmirror.com/mirrors/phantomjs"
electron_mirror "https://npmmirror.com/mirrors/electron"

View File

@ -1,14 +1,7 @@
export default { module.exports = {
/** title: "lilishop", //配置显示在浏览器标签的title
* @description 配置显示在浏览器标签的title aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key
*/ website: "https://www.pickmall.cn", //官网地址
title: "lilishop", enableCDN: true, //生产环境 是否启用cdn加载 vue等js
/** port:10003, //端口
* @description 高德web端申请的api key
*/
aMapKey: "b440952723253aa9fe483e698057bf7d",
/**
* @description 官网地址
*/
website: "https://www.pickmall.cn",
}; };

View File

@ -1,7 +1,5 @@
import config from '@/config/index'
export default { export default {
lili: config.title,
usernameLogin: 'UsernameLogin', usernameLogin: 'UsernameLogin',
mobileLogin: 'MobileLogin', mobileLogin: 'MobileLogin',
autoLogin: 'Auto Login', autoLogin: 'Auto Login',

View File

@ -1,6 +1,5 @@
import config from '@/config/index'
export default { export default {
lili: config.title,
usernameLogin: '账户密码登录', usernameLogin: '账户密码登录',
mobileLogin: '手机号登录', mobileLogin: '手机号登录',
autoLogin: '自动登录', autoLogin: '自动登录',

View File

@ -1,5 +1,6 @@
import Main from "@/views/Main.vue"; import Main from "@/views/Main.vue";
import config from '@/config/index'
const config = require('@/config/index')
// 不作为Main组件的子页面展示的页面单独写如下 // 不作为Main组件的子页面展示的页面单独写如下
export const loginRouter = { export const loginRouter = {
path: "/login", path: "/login",

View File

@ -13,7 +13,8 @@
</template> </template>
<script> <script>
import config from '@/config/index'
const config = require('@/config/index')
export default { export default {
name: "footer", name: "footer",
data() { data() {

View File

@ -31,7 +31,8 @@
<script> <script>
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { getRegion } from "@/api/common.js"; import { getRegion } from "@/api/common.js";
import config from '@/config'
const config = require('@/config/index')
export default { export default {
data() { data() {
return { return {

View File

@ -255,8 +255,8 @@ import {
deleteFile, deleteFile,
} from "@/api/index"; } from "@/api/index";
import DPlayer from "dplayer"; import DPlayer from "dplayer";
import config from "@/config";
const config = require('@/config/index')
import { commonUrl } from "@/libs/axios"; import { commonUrl } from "@/libs/axios";
var dp; var dp;
export default { export default {

View File

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

View File

@ -0,0 +1,5 @@
registry "https://registry.npmmirror.com"
sass_binary_site "https://npmmirror.com/mirrors/node-sass"
phantomjs_cdnurl "https://npmmirror.com/mirrors/phantomjs"
electron_mirror "https://npmmirror.com/mirrors/electron"

View File

@ -1,16 +1,7 @@
export default { module.exports = {
/** title: "lilishop", //配置显示在浏览器标签的title
* @description 配置显示在浏览器标签的title aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key
*/ website: "https://www.pickmall.cn", //官网地址
title: "lilishop", enableCDN: true, //生产环境 是否启用cdn加载 vue等js
port:10002, //端口
/**
* @description 高德web端申请的api key
*/
aMapKey: "b440952723253aa9fe483e698057bf7d",
/**
* @description 官网地址
*/
website: "https://www.pickmall.cn",
}; };

View File

@ -2,7 +2,8 @@ import lazyLoading from './lazyLoading.js';
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import { result } from './routerJson.js'; import { result } from './routerJson.js';
import config from '@/config/index' const config = require('@/config/index')
let util = { let util = {
}; };

View File

@ -1,5 +1,6 @@
import Main from "@/views/Main.vue"; import Main from "@/views/Main.vue";
import config from '@/config/index'
const config = require('@/config/index')
// 不作为Main组件的子页面展示的页面单独写如下 // 不作为Main组件的子页面展示的页面单独写如下
export const loginRouter = { export const loginRouter = {
path: "/login", path: "/login",

View File

@ -13,7 +13,8 @@
</template> </template>
<script> <script>
import config from '@/config/index'
const config = require('@/config/index')
export default { export default {
name: "footer", name: "footer",
data() { data() {

View File

@ -31,7 +31,8 @@
<script> <script>
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { getRegion } from "@/api/common.js"; import { getRegion } from "@/api/common.js";
import config from '@/config'
const config = require('@/config/index')
export default { export default {
name: "map", name: "map",
data() { data() {

View File

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