From 2cb5e34af37be6e7f314dab5bfcd02cfd50bd1c8 Mon Sep 17 00:00:00 2001 From: JimQing <33045162+JimQing@users.noreply.github.com> Date: Sun, 28 Feb 2021 15:39:08 +0800 Subject: [PATCH] fix: support netlify build env MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update frame to uni-app * fix: bug fix * fix: bug fix * 修改输出路径 * feat: publicPath * feat: manifest update * fix: cssEditor theme * fix: style * style: format code with prettier * fix: table style & copy style on the night mode * fix: upload image * fix: style * feat: build:h5 for netlify * delete console * fix: netlify publicPath Co-authored-by: yanglbme --- package.json | 1 + src/manifest.json | 134 +++++++++++++++++++++++----------------------- vue.config.js | 2 +- 3 files changed, 69 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index e4f8d1b..f99df04 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build", "build:custom": "cross-env NODE_ENV=production uniapp-cli custom", "build:h5": "cross-env NODE_ENV=production UNI_OUTPUT_DIR=dist UNI_PLATFORM=h5 vue-cli-service uni-build", + "build:h5-netlify": "cross-env NODE_ENV=production SERVER_ENV=NETLIFY UNI_OUTPUT_DIR=dist UNI_PLATFORM=h5 vue-cli-service uni-build", "build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build", "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build", "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build", diff --git a/src/manifest.json b/src/manifest.json index 3dcb92b..b8d16ac 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,71 +1,71 @@ { - "name": "uni-md", - "appid": "", - "description": "", - "versionName": "1.0.0", - "versionCode": "100", - "transformPx": false, - "h5": { - "publicPath": "/md/" - }, - "app-plus": { - "usingComponents": true, - "splashscreen": { - "alwaysShowBeforeRender": true, - "waiting": true, - "autoclose": true, - "delay": 0 - }, - "modules": {}, - "distribute": { - "android": { - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - "ios": {}, - "sdkConfigs": {} - } - }, - "quickapp": {}, - "mp-weixin": { + "name": "uni-md", "appid": "", - "setting": { - "urlCheck": false + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "h5": { + "publicPath": "/" }, - "usingComponents": true - }, - "mp-alipay": { - "usingComponents": true - }, - "mp-baidu": { - "usingComponents": true - }, - "mp-toutiao": { - "usingComponents": true - }, - "mp-qq": { - "usingComponents": true - } + "app-plus": { + "usingComponents": true, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": {}, + "distribute": { + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "ios": {}, + "sdkConfigs": {} + } + }, + "quickapp": {}, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "mp-qq": { + "usingComponents": true + } } diff --git a/vue.config.js b/vue.config.js index 3b65895..660c691 100644 --- a/vue.config.js +++ b/vue.config.js @@ -7,7 +7,7 @@ function writeManifestJson() { const strData = data.toString(); const manifest = JSON.parse(strData); - manifest.h5.publicPath = process.env.NETLIFY ? "/" : "/md/"; + manifest.h5.publicPath = process.env.SERVER_ENV !== 'NETLIFY' ? "/md/": "/"; const result = JSON.stringify(manifest, null, 4); fs.writeFile("./src/manifest.json", result, function (err) {