Skip to content

Commit

Permalink
use CDN for webworker url properly (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar authored Jan 19, 2025
1 parent 159fb8b commit be101da
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ The CircuitJsonPreview component provides:
- Circuit JSON viewer
- Error display

> Note: You should have tailwind installed in the parent project, this library
> works without installing tailwind but without the "css reset" things will look
> a bit off (e.g. you might see serif fonts), create an issue if that's
> cumbersome because we removed it to save 5kb
### Providing the Blob URL (to avoid loading webworker from CDN)

```tsx
import evalWebWorkerBlobUrl from "@tscircuit/eval-webworker/blob-url"
```

## Development

Expand Down
Binary file modified bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions lib/components/RunFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ declare global {
var runFrameWorker: any
}

// @ts-ignore
import evalWebWorkerBlobUrl from "@tscircuit/eval-webworker/blob-url"
import type { ManualEditEvent } from "@tscircuit/props"
import { useRunFrameStore } from "./RunFrameWithApi/store"
import { getChangesBetweenFsMaps } from "../utils/getChangesBetweenFsMaps"
Expand Down Expand Up @@ -93,6 +91,8 @@ interface Props {
defaultActiveTab?: Parameters<
typeof CircuitJsonPreview
>[0]["defaultActiveTab"]

evalWebWorkerBlobUrl?: string
}

export const RunFrame = (props: Props) => {
Expand Down Expand Up @@ -166,7 +166,7 @@ export const RunFrame = (props: Props) => {
const worker: Awaited<ReturnType<typeof createCircuitWebWorker>> =
globalThis.runFrameWorker ??
(await createCircuitWebWorker({
webWorkerUrl: evalWebWorkerBlobUrl,
webWorkerUrl: props.evalWebWorkerBlobUrl,
verbose: true,
}))
globalThis.runFrameWorker = worker
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"@radix-ui/react-tabs": "^1.1.2",
"@tscircuit/3d-viewer": "^0.0.101",
"@tscircuit/assembly-viewer": "^0.0.1",
"@tscircuit/eval-webworker": "^0.0.72",
"@tscircuit/core": "^0.0.273",
"@tscircuit/eval-webworker": "^0.0.69",
"@tscircuit/file-server": "^0.0.13",
"@tscircuit/pcb-viewer": "^1.11.29",
"@tscircuit/props": "^0.0.130",
Expand All @@ -68,6 +68,7 @@
"clsx": "^2.1.1",
"comlink": "^4.4.2",
"cssnano": "^7.0.6",
"jscad-fiber": "^0.0.76",
"lucide-react": "^0.473.0",
"react-cosmos-plugin-vite": "^6.2.0",
"schematic-symbols": "^0.0.111",
Expand Down

0 comments on commit be101da

Please sign in to comment.