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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ debug-output

# Snapshot diff files
*.diff.png
.vercel
10 changes: 8 additions & 2 deletions lib/mesh-generation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { CircuitJson } from "circuit-json"
import type { Triangle as GLTFTriangle } from "circuit-json-to-gltf"
import { convertCircuitJsonTo3D } from "circuit-json-to-gltf"
import type { Ref } from "stepts"
import type { Triangle as GLTFTriangle } from "circuit-json-to-gltf"
import type { Repository } from "stepts"
import {
AdvancedFace,
Expand Down Expand Up @@ -315,6 +314,13 @@ export async function generateComponentMeshes(
return e
})

// Dynamically import circuit-json-to-gltf to avoid bundling native dependencies
// Use a variable to prevent the bundler from statically analyzing the import
const gltfModule = "circuit-json-to-gltf"
const { convertCircuitJsonTo3D } = await import(
/* @vite-ignore */ gltfModule
)

// Convert circuit JSON to 3D scene
const scene3d = await convertCircuitJsonTo3D(filteredCircuitJson, {
boardThickness,
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
"test:update-snapshots": "BUN_UPDATE_SNAPSHOTS=1 bun test",
"build": "tsup-node ./lib/index.ts --format esm --dts",
"format": "biome format --write .",
"format:check": "biome format ."
"format:check": "biome format .",
"start": "bun site/index.html",
"build:site": "bun build site/index.html --outdir=site-export"
},
"devDependencies": {
"@biomejs/biome": "^2.3.8",
"@resvg/resvg-js": "^2.6.2",
"@resvg/resvg-wasm": "^2.6.2",
"@types/bun": "latest",
"circuit-json": "^0.0.286",
"looks-same": "^10.0.1",
Expand Down
Loading