Skip to content

Browsers and bundlers

Browser entry

The package has a browser export condition. For an explicit browser entry:

ts
import { createVectorEngine } from 'laneops/browser'

Resolve Wasm assets

Default Wasm assets are resolved relative to the emitted JS module with new URL. If your bundler moves assets, pass URLs, a BufferSource, or a compiled WebAssembly.Module. For example, with Vite:

ts
import { createVectorEngine } from 'laneops/browser'
import scalarUrl from 'laneops/wasm/scalar?url'
import simdUrl from 'laneops/wasm/simd?url'

const engine = await createVectorEngine({
  wasm: {
    scalar: new URL(scalarUrl, location.href),
    simd: new URL(simdUrl, location.href),
  },
})

Loading and compatibility

The loader probes SIMD support before loading an asset. An invalid or missing selected asset is an error, rather than silently hiding a deployment problem. Both variants use private ABI v6. Native and Wasm assets must match the JS ABI version and generated SHA-256 registry fingerprint before any operation runs. Browsers need WebAssembly, fetch, and ES2022 module support; shared memory and cross-origin isolation are unnecessary. The browser entry imports no Node modules.

Worker assets

Worker execution also needs a bundled runtime URL. Follow the Vite Worker example, which configures both Worker and Wasm assets.

Released under the MIT License.