Skip to content

Load the WebAssembly backend via dynamic import to shrink the main bundle #19

Description

@kameronbrooks

Plan item #49a. nsengine.ts statically imports WasmExecutor so that new NSEngine({ backend: 'wasm' }) can stay synchronous. That adds roughly 40 KB unminified (~10 KB gzipped) of code generator to the main bundle even for consumers that never leave the default js backend, and defeats tree-shaking for the main entry (the ./wasm subpath export exists but doesn't help the main path).

If bundle size matters more than a synchronous constructor, switch to a dynamic import() behind runAsync (or an async factory). Decide and document either way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions