Skip to content

Allow externalized Wasm build #96

Open
@guybedford

Description

@guybedford

We landed and reverted #91 which gave the ability to point to an externalized Wasm file for the lexer build.

As far as I'm aware the primary requirement here was not to use base64 encoding, but to instead load the Wasm from a separate file, that could be vetted at distribution time.

Therefore the suggestion is to have two builds of cjs-module-lexer - one like the existing one that inlines the base64 and one new one that automatically loads the lexer wasm from a separate wasm file.

In our build process we then generate these two new builds allowing consumers to select which one they want to use.

There is therefore:

  • No need for a runtime environment variable at all
  • We can ALWAYS generate two builds - one with the inlined binary, and one that loads the binary from a separate file
  • No environment variable is then needed for the build script at all
  • Only one define variable is needed for WASM_BINARY- whether or not the binary is being generated inline, with the undefined case indicating the external case, unless we absolutely need to customize the external path at build time?

I am also still unclear on why a new exports entry point was needed for this alternative build as well. There is already CJS entry point generation in the npm run build script, which just needs to be extended to the new entry point being generated as well.

//cc @mochaaP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions