diff --git a/changelog.md b/changelog.md index ad339c5..68ff929 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,7 @@ - 修复 轻量模式延迟启动延时输入数值问题(#962) - 修复 轻量模式下轻量模式下规则失效的问题(#963) - 修复 MacOS 下默认虚拟网卡名称没有生效的问题 +- 修复 ES Module 兼容性问题 ### 样式调整 (Sytle) - 部分样式微调 diff --git a/scripts/prepare.mjs b/scripts/prepare.mjs index edf83dd..e6c1757 100644 --- a/scripts/prepare.mjs +++ b/scripts/prepare.mjs @@ -351,7 +351,7 @@ const resolve7zip = () => }) const resolveSubstore = () => resolveResource({ - file: 'sub-store.bundle.js', + file: 'sub-store.bundle.cjs', downloadURL: 'https://github.com/sub-store-org/Sub-Store/releases/latest/download/sub-store.bundle.js' }) diff --git a/src/main/resolve/server.ts b/src/main/resolve/server.ts index ce40526..f7eacf4 100644 --- a/src/main/resolve/server.ts +++ b/src/main/resolve/server.ts @@ -119,7 +119,7 @@ export async function startSubStoreBackendServer(): Promise { SUB_STORE_MMDB_COUNTRY_PATH: path.join(mihomoWorkDir(), 'country.mmdb'), SUB_STORE_MMDB_ASN_PATH: path.join(mihomoWorkDir(), 'ASN.mmdb') } - subStoreBackendWorker = new Worker(path.join(mihomoWorkDir(), 'sub-store.bundle.js'), { + subStoreBackendWorker = new Worker(path.join(mihomoWorkDir(), 'sub-store.bundle.cjs'), { env: useProxyInSubStore ? { ...env, @@ -143,7 +143,7 @@ export async function stopSubStoreBackendServer(): Promise { export async function downloadSubStore(): Promise { const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig() const frontendDir = path.join(mihomoWorkDir(), 'sub-store-frontend') - const backendPath = path.join(mihomoWorkDir(), 'sub-store.bundle.js') + const backendPath = path.join(mihomoWorkDir(), 'sub-store.bundle.cjs') const tempDir = path.join(dataDir(), 'temp') try { @@ -154,7 +154,7 @@ export async function downloadSubStore(): Promise { mkdirSync(tempDir, { recursive: true }) // 下载后端文件 - const tempBackendPath = path.join(tempDir, 'sub-store.bundle.js') + const tempBackendPath = path.join(tempDir, 'sub-store.bundle.cjs') const backendRes = await axios.get( 'https://github.com/sub-store-org/Sub-Store/releases/latest/download/sub-store.bundle.js', { diff --git a/src/main/utils/init.ts b/src/main/utils/init.ts index ce4f69b..709366d 100644 --- a/src/main/utils/init.ts +++ b/src/main/utils/init.ts @@ -185,7 +185,7 @@ async function initFiles(): Promise { copy('geoip.dat'), copy('geosite.dat'), copy('ASN.mmdb'), - copy('sub-store.bundle.js'), + copy('sub-store.bundle.cjs'), copy('sub-store-frontend') ]) }