fix: support native wasm dependencies in vite ssr - #3904
Open
dvd233 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.wasm, preserving the wrapper and binary under the same Deno module graphjsr:@deno/doc@0.202.1dependency and execute its Wasm-backeddoc()APIWhy
Vite's Wasm support expects its own asset/import conventions, such as
?init, while generated Deno packages use native ESM Wasm imports. Treating the binary as a regular Vite module makes import analysis parse Wasm bytes as JavaScript. Adding*.wasmtoassetsIncludewould instead turn the import into a URL string, which does not satisfy the generated wrapper's module-namespace contract.The server resolver now leaves those native Wasm edges to Deno, while browser and non-default module resolution remain unchanged.
Tests
deno_doc_wasm.wasmimport-analysis failuredeno test -A --cached-only packages/plugin-vite/tests/build_test.ts packages/plugin-vite/tests/dev_server_test.ts: 79 passed, 0 failed, 1 existing ignored testdeno task check:typesdeno fmt --check,deno lint, anddeno check@deno/docfixturegit diff --checkNote: the repository-wide formatter reports pre-existing differences in
www/static/docsearch.cssandwww/static/prism.css; this PR does not touch either generated/static file.Fixes #3897