Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"motion-v": "^2.3.0",
"pinia": "^2.1.7",
"qrcode": "^1.5.4",
"three": "0.180.0",
"vue": "^3.4.0",
"vue-chartjs": "^5.3.0",
"vue-draggable-plus": "^0.6.1",
Expand All @@ -44,6 +45,7 @@
"@types/mdx": "^2.0.13",
"@types/node": "^20.10.5",
"@types/qrcode": "^1.5.6",
"@types/three": "0.180.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-vue": "^5.2.3",
Expand Down
59 changes: 59 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 2 additions & 23 deletions frontend/src/utils/threeRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
const THREE_MODULE_URLS = [
'https://cdn.jsdelivr.net/npm/three@0.180.0/build/three.module.min.js',
'https://unpkg.com/three@0.180.0/build/three.module.min.js'
] as const

async function importThreeFromCdn() {
let lastError: unknown

for (const url of THREE_MODULE_URLS) {
try {
return await import(/* @vite-ignore */ url)
} catch (error) {
lastError = error
}
}

throw lastError instanceof Error
? lastError
: new Error('Unable to load the pinned Three.js runtime')
}

let threeModulePromise: ReturnType<typeof importThreeFromCdn> | null = null
let threeModulePromise: Promise<any> | null = null

export function loadThree() {
if (!threeModulePromise) {
threeModulePromise = importThreeFromCdn().catch((error) => {
threeModulePromise = import('three').catch((error) => {
threeModulePromise = null
throw error
})
Expand Down