-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when importing on vite #1106
Comments
rustwasm/wasm-bindgen#2779 cross-posting the issue partially solved but still in progress on wasm-bindgen repo |
I did some more digging while attempting to import |
For me, Vite was showing the error: I fixed it by importing package.json: {
"dependencies": {
"my-crate": "link:../my-crate/pkg"
}
} JS: import init, { ... } from "my-crate";
import wasmUrl from "my-crate/my_crate_bg.wasm?url";
init(wasmUrl).then(() => { ... }); Seemed to work with either |
@hazelmeow: Thanks for this! Seems like a very clean way to make The recommended way nowadays appears to be to use the default To change existing code to this approach, the following steps are needed:
|
…ding WebAssembly component Fixes dev-mode. This makes use of native Vite capabilities to load the WebAssembly component and appears to be the recommended approach nowadays. See: rustwasm/wasm-pack#1106 (comment)
…ding WebAssembly component Fixes dev-mode. This makes use of native Vite capabilities to load the WebAssembly component and appears to be the recommended approach nowadays. See: rustwasm/wasm-pack#1106 (comment)
…ding WebAssembly component Fixes dev-mode. This makes use of native Vite capabilities to load the WebAssembly component and appears to be the recommended approach nowadays. See: rustwasm/wasm-pack#1106 (comment)
…ding WebAssembly component (#75) * Switch to `wasm-pack build --target bundler` and Vite plugins for loading WebAssembly component Fixes dev-mode. This makes use of native Vite capabilities to load the WebAssembly component and appears to be the recommended approach nowadays. See: rustwasm/wasm-pack#1106 (comment) * Fix package-lock.json not matching up * Mention updated port for dev-environment with newer Vite * Fix release builds by pinning @swc/core to 1.6.* Apparently @swc/core 1.7.0 (recently released) has a regression that breaks vite-plugin-top-level-await: Menci/vite-plugin-top-level-await#52 * Commit difference between package-lock.json generated by NPM 10 in Docker environment vs NPM 9 locally --------- Co-authored-by: Eric Zhang <ekzhang1@gmail.com>
it's this code that creates that error
this package was built with latest wasm-pack with
--target web
option.The text was updated successfully, but these errors were encountered: