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 configContent = `{
  "files": "build${scene ? '/' + scene : ''}/js/*.js",
  "from": "https://super.4dage.com",
  "to": "."
}`;

fs.writeFileSync(`${_dirname}/offline-replace-config.json`, configContent, 'utf-8');

console.log(`offline-replace-config.json 已生成，场景: ${scene}`);
