Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"browser.js",
"cloudflare.js",
"default.js",
"node.mjs"
"node.mjs",
"unwasm.mjs"
],
"types": "dist/index.d.ts",
"exports": {
Expand All @@ -21,6 +22,7 @@
"bun": "./bun.js",
"workerd": "./cloudflare.js",
"edge-light": "./vercel.js",
"unwasm": "./unwasm.mjs",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Condition added after no-op environments and before the node that mainly needs takeover

"node": "./node.mjs",
"browser": "./browser.js",
"default": "./default.js"
Expand Down
7 changes: 7 additions & 0 deletions unwasm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import init from './dist/html_rewriter.js'

import { HTMLRewriterWrapper } from './dist/html_rewriter_wrapper.js'

import wasm from './dist/html_rewriter_bg.wasm?module'
Copy link
Copy Markdown
Author

@pi0 pi0 Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: unwasm also supports ESM exports without ?module if there are import paths, this allows later leveraging tree-shaking if needed. Otherwise, this current syntax uses source module import to be initialized as module later without trying to parse .wasm file import/exports


export const HTMLRewriter = HTMLRewriterWrapper(init(wasm))