Menci / Menci/vite-plugin-wasm

Potentially inaccurate information for configuration regarding Firefox support

Open
#85 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

need more info
Dominant language
JavaScript
Stars
431
Forks
27
PR merge metrics
No merged PRs in 30d

Description

I was trying to run a wasm module built with wasm pack --bundle and I followed the directions of the readme in this repo. I'm on Firefox Developer Edition 148.0b15 (64-bit). Building with Vite didn't work until I uncommented the format config line.

  worker: {
    // Not needed with vite-plugin-top-level-await >= 1.3.0
    format: "es",
    plugins: () => [wasm(), topLevelAwait()],
  },

Does that need to be changed? The docs say that line shouldn't be necessary.

My package.json file has this

    "vite": "^6.3.5",
    "vite-plugin-top-level-await": "^1.6.0",
    "vite-plugin-wasm": "^3.5.0",

and vite.config.ts

export default defineConfig({
  plugins: [solidPlugin(), tailwindcss(), wasm(), topLevelAwait()],
  worker: {
    // Not needed with vite-plugin-top-level-await >= 1.3.0
    format: "es",
    plugins: () => [wasm(), topLevelAwait()],
  },
// other build options
});

I'm building a browser extension. I was trying to have my extension's background script spin up a web worker which would load the wasm module. I was using npm run build -w because the extension needs the built code to be loaded by the browser. I could load the wasm module fine if it wasn't in a web worker prior to uncommenting that line in the config.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README section describing Firefox support and the Vite worker configuration, then compare it with the package.json versions and vite.config.ts example provided in the report. Reproduce the browser-extension build with the shown worker settings if possible. Done means the documentation accurately states whether format: "es" is required for this Firefox and plugin combination.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript, vite
Domain
build-system, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.