mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-26 12:50:33 +08:00
公共服务器前端不生成source map
This commit is contained in:
parent
06e5481574
commit
48154b2be9
2
frontend/.env
Normal file
2
frontend/.env
Normal file
@ -0,0 +1,2 @@
|
||||
LIB_USE_CDN=false
|
||||
PROD_SOURCE_MAP=true
|
3
frontend/.env.common_server
Normal file
3
frontend/.env.common_server
Normal file
@ -0,0 +1,3 @@
|
||||
NODE_ENV=production
|
||||
LIB_USE_CDN=true
|
||||
PROD_SOURCE_MAP=false
|
1
frontend/.gitignore
vendored
1
frontend/.gitignore
vendored
@ -5,6 +5,7 @@ node_modules
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
!.env
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
|
@ -5,6 +5,7 @@
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"build_common_server": "vue-cli-service build --mode common_server",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -1,7 +1,16 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
|
||||
// 不能用localhost,https://forum.dfinity.org/t/development-workflow-quickly-test-code-modifications/1793/21
|
||||
const API_BASE_URL = 'http://127.0.0.1:12450'
|
||||
|
||||
module.exports = {
|
||||
function toBool(val) {
|
||||
if (typeof val === 'string') {
|
||||
return ['false', 'no', 'off', '0', ''].indexOf(val.toLowerCase()) === -1
|
||||
}
|
||||
return Boolean(val)
|
||||
}
|
||||
|
||||
module.exports = defineConfig({
|
||||
devServer: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
@ -16,12 +25,14 @@ module.exports = {
|
||||
},
|
||||
}
|
||||
},
|
||||
productionSourceMap: toBool(process.env.PROD_SOURCE_MAP),
|
||||
chainWebpack: config => {
|
||||
const APP_VERSION = `v${process.env.npm_package_version}`
|
||||
const LIB_USE_CDN = toBool(process.env.LIB_USE_CDN)
|
||||
|
||||
const ENV = {
|
||||
APP_VERSION,
|
||||
LIB_USE_CDN: true,
|
||||
LIB_USE_CDN,
|
||||
}
|
||||
config.plugin('define')
|
||||
.tap(args => {
|
||||
@ -33,7 +44,7 @@ module.exports = {
|
||||
return args
|
||||
})
|
||||
|
||||
if (ENV.LIB_USE_CDN) {
|
||||
if (LIB_USE_CDN) {
|
||||
config.externals({
|
||||
'element-ui': 'ELEMENT',
|
||||
lodash: '_',
|
||||
@ -44,4 +55,4 @@ module.exports = {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user