Archived
为什么:index.html 单体 4600 行 ES5 已到维护极限,迁移到 Vite 工程 获得热更新、类型检查与模块化能力。迁移策略是保真优先——业务逻辑 不重写为 React 组件(行为漂移风险),而是逐字移植为 legacy.ts/auth.ts 两个 @ts-nocheck 控制器模块;React 只接管静态 骨架与响应式显隐(tab/modal/drawer/toast),动态列表/播放器/歌词 仍走 id + innerHTML 命令式更新。 关键决策: - boot 包装:旧脚本原在 body 末尾可直取 DOM,模块化后顶层事件 绑定会在 import 求值时打在 null 上,全部副作用包进 __legacyBoot()/__authBoot() 由 App useEffect 骨架落盘后调用 - 轻量 store:单一可变 AppState + notify() + useSyncExternalStore, 沿用旧版"改 state 后手动通知"心智模型 - modalBus:弹窗栈 + useSyncExternalStore,Escape 走 closeTopmost, stats/cookie 弹窗经 __legacyApi 调 legacy 内部专用关闭(清定时器/ 复位视图) - vite 固定产物文件名(无内容 hash),保证 index.html 字节级稳定, golden sha256 契约才跨构建成立
23 lines
591 B
JSON
23 lines
591 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2020",
|
|
"useDefineForClassFields": true,
|
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
"module": "ESNext",
|
|
"skipLibCheck": true,
|
|
"moduleResolution": "bundler",
|
|
"allowImportingTsExtensions": true,
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true,
|
|
"noEmit": true,
|
|
"jsx": "react-jsx",
|
|
"strict": false,
|
|
"noUnusedLocals": false,
|
|
"noUnusedParameters": false,
|
|
"noImplicitAny": false,
|
|
"allowJs": true
|
|
},
|
|
"include": ["src"],
|
|
"exclude": ["src/controllers/legacy.ts", "src/controllers/auth.ts"]
|
|
}
|