- 新增 GLB/GLTF 模型加载与渲染,支持内嵌动画播放 - 通过 IndexedDB 持久化大体积模型二进制,规避 localStorage 限制 - 新增动作片段序列,时间轴可添加、编辑与编排多段动作 - 优化机位视角相机同步,修复角度修改不生效问题 - 扩展骨骼识别,兼容 Mixamo 前缀及 UE4 骨架
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { defineConfig } from "vitest/config";
|
||
import react from "@vitejs/plugin-react";
|
||
|
||
// Windows 上 new URL().pathname 形如 "/D:/...",前导斜杠会让 Vite 解析成 "D:/D:/..."。
|
||
// 去掉盘符前的斜杠,避免 dev server 的 fs.allow 把真实路径判为越界(403 Restricted)。
|
||
const toFsPath = (url: URL) => decodeURIComponent(url.pathname.replace(/^\/(?=[A-Za-z]:\/)/, ""));
|
||
|
||
export default defineConfig({
|
||
base: "./",
|
||
assetsInclude: ["**/*.fbx", "**/*.obj", "**/*.glb", "**/*.gltf"],
|
||
// 强制单一 three 实例:GLTFLoader / KTX2Loader / DRACOLoader / meshopt 等 examples/jsm 模块
|
||
// 会再次 import "three",vitest 的依赖优化器可能拆出第二份 three,导致 R3F 上下文里的
|
||
// useThree/useFrame 报 "Multiple instances of Three.js" 而失效。dedupe 保证全工程只有一份。
|
||
resolve: {
|
||
dedupe: ["three", "@react-three/fiber", "@react-three/drei"],
|
||
},
|
||
plugins: [react()],
|
||
server: {
|
||
fs: {
|
||
allow: [
|
||
toFsPath(new URL(".", import.meta.url)),
|
||
toFsPath(new URL("../模型库", import.meta.url)),
|
||
],
|
||
},
|
||
},
|
||
test: {
|
||
environment: "jsdom",
|
||
globals: true,
|
||
pool: "threads",
|
||
maxWorkers: 1,
|
||
setupFiles: "./src/test/setup.ts",
|
||
},
|
||
});
|