Skip to content

Conversation

@orimay
Copy link
Contributor

@orimay orimay commented Nov 24, 2025

Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.

What is the motivation?

createWasmWorkerEngines is incompatible with Vite-based projects

What does this change do?

Allows to create worker, specifying worker agent:

import WorkerAgent from '@surrealdb/wasm/worker?worker';

const db = new Surreal({
  engines: createWasmWorkerEngines({
    createWorker: () => new WorkerAgent(),
  }),
});

What is your testing strategy?

I was not able to test it due to a missing dependency

import type { ConnectionOptions } from "../wasm/surrealdb";

Is this related to any issues?

#497 (comment)

Have you read the Contributing Guidelines?

@orimay orimay requested a review from kearfy as a code owner November 24, 2025 17:28
@sandros94
Copy link

I wanted to help trying this out but failing to build wasm locally (getting wasm32-unknown-unknown which I honestly do not know what I'm doing wrong).

Theoretically, as long as Vite can statically parse the worker-agent, it should be able to interpret the inner new URL("../wasm/surrealdb_bg.wasm", import.meta.url) from initializeLibrary in common.ts, meaning no additional fixes are required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants