Skip to content

Registering the wasm folder vs JavaScript bundlers #1259

Open
@andy-wrks

Description

@andy-wrks

What is your idea?

Currently the wasm file is registered via a path:
...settings.wasm.path = wasmPath;

This is problematic when using bundlers, which usually rely on bundling specific files and resolving a file path (rather than a folder path).
For example, it's not possible to use the cache busting feature of esbuild with webifc.wasm. How this usually works: esbuild includes a hash in the file name when bundling the file to the "dist" folder. It then resolves the file path to the new file name, like dist/webifc-1f67a5.wasm
However, since webifc looks for a hard coded file name inside a folder, this cache-busting technique can't work.
(In the case of esbuild, cache busting is the default bevahiour and it has to be turned off manually. Then the file name has to be deleted from the resolved path to provide a folder path for webifc.)

So to make web-ifc more compatible with common bundling workflows, I'd suggest to register the wasm file rather than the folder. Since there's only one wasm file anyway, it shouldn't make much of a difference.

Thanks for taking this into consideration and thanks for providing this great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions