Skip to main content
Use WebAssembly in your extension without custom bundler setup. Extension.js ships with built-in WebAssembly (Wasm) defaults in its Rspack pipeline, so common Wasm workflows work out of the box.

When WebAssembly is a good fit

  • Your extension runs compute-heavy tasks (parsing, media, OCR, transforms).
  • You need near-native performance for hot code paths.
  • You are reusing existing Wasm modules from web projects.

WebAssembly capabilities

CapabilityWhat it gives you
Built-in Wasm pipeline defaultsRun common Wasm flows without manual bundler wiring
Async Wasm supportLoad .wasm modules in extension contexts
Runtime compatibility helpersHandle common Wasm ecosystem asset patterns
Regular command workflowUse Wasm with the same dev and build commands

Template example

sidebar-transformers-js template screenshot AI/ML sidebar extension using Transformers.js with WebAssembly-powered inference.
npx extension@latest create my-extension --template=sidebar-transformers-js
Repository: extension-js/examples/sidebar-transformers-js

What Extension.js enables

The Wasm plugin configures:
  • experiments.asyncWebAssembly = true
  • .wasm in module resolution extensions
  • path aliases for common Wasm libraries (for example, ffmpeg, imagemagick, and tesseract) so imports resolve correctly at runtime
This reduces boilerplate when importing Wasm modules from extension scripts/pages.

How to use

Use Wasm modules in your extension code as part of regular development/build flows:
npx extension dev ./my-extension
You can also test against a known public Wasm sample:
npx extension@latest dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/cookbook.wasm-helloworld-print

Typical use cases

  • compute-heavy parsing/transforms
  • media processing pipelines
  • OCR / image processing workflows
  • performance-sensitive algorithms shared across web/runtime contexts

Best practices

  • Keep Wasm modules focused on hot paths; keep orchestration logic in JavaScript/TypeScript.
  • Validate output size and load timing for extension contexts (background, content scripts, pages).
  • Test Wasm-heavy flows across browser targets you ship (chrome, edge, firefox).

Next steps