From d6426d338e1467c4a92fc7cb36c783bbb7760fa5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 9 Mar 2026 09:53:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.js | 7 ++++++- index.html | 12 ++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/build.js b/build.js index b09b785..b4dcf46 100644 --- a/build.js +++ b/build.js @@ -2,6 +2,7 @@ /** * 将静态资源复制到 dist/,便于直接部署到任意静态主机。 * 产出: dist/index.html, dist/config.json, dist/lib/, dist/image/ + * 构建时注入 __CACHE_VERSION__ 为时间戳,用于防微信/浏览器强缓存,保证发版后页面可更新。 */ const fs = require('fs'); const path = require('path'); @@ -56,7 +57,11 @@ function main() { } fs.mkdirSync(DIST, { recursive: true }); - copyFile(path.join(ROOT, 'index.html'), path.join(DIST, 'index.html')); + 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, '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')); diff --git a/index.html b/index.html index 790f8eb..8d37113 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,12 @@ + + + 全景查看 - + +