Skip to content

Comments

fix(cli): use new URL instead of ?url for browser wasm fetching#2511

Closed
hi-ogawa wants to merge 2 commits intonapi-rs:mainfrom
hi-ogawa:fix-wasi-browser-new-url
Closed

fix(cli): use new URL instead of ?url for browser wasm fetching#2511
hi-ogawa wants to merge 2 commits intonapi-rs:mainfrom
hi-ogawa:fix-wasi-browser-new-url

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Mar 15, 2025

Related vitejs/vite#19639, oxc-project/oxc#9783
Closes #2517

I was testing napi-rs oxc-parser package on browser (see sample app in oxc-project/oxc#9783) and noticed that ?url is causing some issues on Vite. Using new URL works around the issue and also I think it's better to avoid ?url since it requires a special bundler side convention.


I just saw the comment on oxc-project/playground#67 (comment) and the example on https://github.com/napi-rs/node-rs-playground/ and this change might not be so simple. Let me double check what's the difference there.

@hi-ogawa hi-ogawa marked this pull request as ready for review March 18, 2025 08:01
@hi-ogawa
Copy link
Contributor Author

As I wrote in #2517 (comment), this change would require Vite users to add optimizeDeps.exclude for napi-rs browser package, but do you think that's okay?

@Brooooooklyn
Copy link
Member

Hmmmm, I think making the Vite user experience silky smooth is the primary goal

@Brooooooklyn Brooooooklyn force-pushed the main branch 3 times, most recently from de8b925 to 9896876 Compare August 7, 2025 14:32
@hi-ogawa hi-ogawa deleted the fix-wasi-browser-new-url branch September 18, 2025 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use new URL(..., import.meta.url) with a relative path in .wasi-browser.js to make the package more portable

2 participants