import { fileURLToPath } from 'node:url'; import { dirname } from 'node:path'; import fs from 'node:fs'; const _filename = fileURLToPath(import.meta.url); const _dirname = dirname(_filename); const scene = process.env.VITE_APP_SCENE; const scenePath = scene ? '/' + scene : ''; const configContent = `{ "files": ["build${scenePath}/js/*.js", "build${scenePath}/data/*.json"], "from": "https://super.4dage.com", "to": "." }`; fs.writeFileSync(`${_dirname}/offline-replace-config.json`, configContent, 'utf-8'); console.log(`offline-replace-config.json 已生成,场景: ${scene}`);