Files

13 lines
658 B
JavaScript
Raw Permalink Normal View History

/* three.js 适配层。
仓库里是 r159 的 UMD 构建(只有 build/three.min.js,没有离线 ESM 版),
所以仍由 index.html 用普通 <script> 先加载,本模块负责:
1) 把它转成真正的 ES 导出,业务代码一律 import 而不是抓全局;
2) 没加载就直接抛错,不要让 "THREE is not defined" 分散成几十个后续异常。
日后换成 ESM 构建时只改这一个文件。 */
const T = globalThis.THREE;
if (!T) {
throw new Error('three.js 未加载:index.html 里 vendor/three.min.js 必须在模块之前以普通脚本引入');
}
export const THREE = T;
export const V3 = T.Vector3;