Skip to content

Repository files navigation

unplugin-dotnet-wasm

Drop .NET WASM apps into JS projects like any other dependency
Works with every major bundler, straight from `dotnet build`

Test status

Why unplugin-dotnet-wasm

unplugin-dotnet-wasm bundles .NET WebAssembly Browser Apps and Blazor WebAssembly Apps with a JavaScript bundler. Set WasmBundlerFriendlyBootConfig on the .NET project, register the plugin, and import _framework/dotnet or Blazor's _framework/blazor.webassembly.js like any other module. Compatible with dotnet build output and with optimized dotnet publish output; hooks into watch mode and/or the bundler's dev server so the inner loop stays on dotnet build.

Built on unplugin: Vite, Webpack, Rollup, Rolldown, Rspack, Rsbuild, esbuild, Farm, and Bun.

Tip

unplugin-dotnet-wasm pairs great with TypeShim for seamless .NET + TypeScript interop.

Install

npm i -D unplugin-dotnet-wasm

Usage, configuration, and per-bundler examples: unplugin-dotnet-wasm/README.md.

Why the plugin is shaped this way: docs/architecture.md.

Run the samples

Make sure to have Node 24+ and .NET 10 SDK installed.

If you don't have pnpm installed yet:

npm install -g pnpm
# or
corepack enable && corepack prepare pnpm@latest --activate

Then install dependencies

pnpm install

The samples are a few apps that bundle one of the .NET libraries in samples/libraries/. The apps (samples/apps/) can be launched by running the following commands from the repo root.

# Vite + vanilla js + WASM library
pnpm build:sample:vite-wasm
pnpm dev:sample:vite-wasm

# Vite + vanilla js + Blazor custom elements
pnpm build:sample:vite-blazor
pnpm dev:sample:vite-blazor

# Webpack + full Blazor app
pnpm build:sample:webpack-blazor
pnpm dev:sample:webpack-blazor

# Rsbuild + React + Blazor custom elements
pnpm build:sample:rsbuild-react
pnpm dev:sample:rsbuild-react

# Farm + React + WASM library
pnpm build:sample:farm-react
pnpm dev:sample:farm-react

# esbuild + Node CLI + WASM library
pnpm build:sample:esbuild-node
pnpm start:sample:esbuild-node

Testing the bun integration additionally requires Bun >= 1.3.

To quickly set up all dependencies for the repo run: ./dev-env-init.ps1

Requirements

  • Node.js >= 24
  • .NET SDK >= 10 (build output must exist before bundling)
  • TypeScript >= 5 (optional - enables editor / tsc type support for .NET WASM imports)

Build, test, and lint commands for this repo: AGENTS.md.

About

Seamless bundling of .NET Browser apps (WASM) into your JS projects

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages