fix:bbug
This commit is contained in:
7
build.js
7
build.js
@@ -2,7 +2,6 @@
|
||||
/**
|
||||
* 将静态资源复制到 dist/,便于直接部署到任意静态主机。
|
||||
* 产出: dist/index.html, dist/config.json, dist/lib/, dist/image/
|
||||
* 构建时注入 __CACHE_VERSION__ 为时间戳,用于防微信/浏览器强缓存,保证发版后页面可更新。
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -57,11 +56,7 @@ function main() {
|
||||
}
|
||||
fs.mkdirSync(DIST, { recursive: true });
|
||||
|
||||
const cacheVersion = String(Date.now());
|
||||
let indexHtml = fs.readFileSync(path.join(ROOT, 'index.html'), 'utf8');
|
||||
indexHtml = indexHtml.replace(/__CACHE_VERSION__/g, cacheVersion);
|
||||
fs.writeFileSync(path.join(DIST, 'index.html'), indexHtml, 'utf8');
|
||||
|
||||
copyFile(path.join(ROOT, 'index.html'), path.join(DIST, 'index.html'));
|
||||
copyFile(path.join(ROOT, 'config.json'), path.join(DIST, 'config.json'));
|
||||
copyFile(path.join(ROOT, 'api.config.json'), path.join(DIST, 'api.config.json'));
|
||||
copyDir(path.join(ROOT, 'lib'), path.join(DIST, 'lib'));
|
||||
|
||||
Reference in New Issue
Block a user