mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
feat: dynamic publicPath
This commit is contained in:
parent
070902093a
commit
6698d0cdda
11
manifest.js
Normal file
11
manifest.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const manifest = require("./src/manifest.json");
|
||||||
|
|
||||||
|
manifest.h5.publicPath = process.env.SERVER_ENV !== "NETLIFY" ? "/md/" : "/";
|
||||||
|
const result = JSON.stringify(manifest, null, 2);
|
||||||
|
|
||||||
|
fs.writeFile("./src/manifest.json", result, function (err) {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
});
|
@ -3,12 +3,12 @@
|
|||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "npm run dev:h5",
|
"serve": "node manifest.js & npm run dev:h5",
|
||||||
"build": "npm run build:h5",
|
"build": "node manifest.js & npm run build:h5",
|
||||||
|
"build:h5-netlify": "cross-env SERVER_ENV=NETLIFY node manifest.js & npm run build:h5",
|
||||||
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
|
"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: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": "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-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-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",
|
"build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
const fs = require("fs");
|
|
||||||
function writeManifestJson() {
|
|
||||||
fs.readFile("./src/manifest.json", function (err, data) {
|
|
||||||
if (err) {
|
|
||||||
return console.error(err);
|
|
||||||
}
|
|
||||||
const strData = data.toString();
|
|
||||||
const manifest = JSON.parse(strData);
|
|
||||||
|
|
||||||
manifest.h5.publicPath = process.env.SERVER_ENV !== "NETLIFY" ? "/md/" : "/";
|
|
||||||
const result = JSON.stringify(manifest, null, 2);
|
|
||||||
|
|
||||||
fs.writeFile("./src/manifest.json", result, function (err) {
|
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user