-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Web] Previously used .wasm binaries missing in 1.19.0 (using web bundler with CopyPlugin) #21811
Comments
The solution to fix this, can be npm install [email protected], all fix the package.json, lock the onnxruntime-web to 1.14.0 version. |
@gotomypc I use |
There are multiple changes for onnxruntime-web exports. a TL;DR version:
Just 2 .wasm files. copy the one you uses. Let me know if you have further questions |
work item: examples should be updated. |
@fs-eire thanks for the reply! I copied the ort-wasm-simd-threaded.jsep.wasm into my static files, made sure I'm using
Strange. I tried to copy the ort-wasm-simd-threaded.wasm and use the base non-gpu version and nothing seems to be working. If I revert back to 1.18.0 everything seems to work. |
What bundler (and version) do you use? It looks like that your bundler is not reading from the "export" field of onnxruntime-web's package.json |
@fs-eire Yeah, and I see the
For reference the web-gpu exports for
Let me give turbopack a try |
Since it's Next.js, make sure not using SSR (because importing 'onnxruntime-web/webgpu' from Node.js is explicitly disabled) |
I'm having the same issue. I made sure to load I made a reproduction here: https://github.com/illbexyz/nextjs-onnxruntime. |
I cloned the repo locally and I can reproduce this error. I am not sure how Next.js deals with this dynamic loading. But I have confirmed that even with import * as onnx from "onnxruntime-web"; in OnnxButton.tsx, it uses the "node" export. This is confirmed by replace the following in node_modules/onnxruntime-web/package.json: "exports": {
".": {
- "node": {
- "import": "./dist/ort.node.min.mjs",
- "require": "./dist/ort.node.min.js"
- },
+ "node": null,
"import": "./dist/ort.bundle.min.mjs",
"require": "./dist/ort.min.js",
"types": "./types.d.ts"
},
This will generate the following error message:
Conclusion: The error is because Next.js module resolver picks export for "node" not "import"/"require"(web) in your repo. I don't know exactly how to change this behavior, but if Next.js picks the "import"/"require"(web) export, the issue should be fixed. |
It's missing |
Yes, you are right. It's missing in the dependencies and need to run |
Yes sorry my bad, I provided a quite sloppy reproduction 😅 In case it might be useful to someone, I updated the reproduction to:
Yes I agree with this conclusion, but I have no idea on how to configure |
Yeah, there has to be a "next.js" way to get around this either with some aliases, dynamic resolving, or client flags. However, for now, I've just worked around it and have been using
And everything works as before. |
the original idea of adding |
@illbexyz I verified the solution mentioned in vercel/next.js#70296 (comment) works. Fix: fs-eire/nextjs-onnxruntime@b7adf6f
|
@fs-eire Thank you! I can confirm that the solution works correctly on Next 14. Unfortunately it doesn't work on Next <= 12 where If @e-simpson agrees I think we can close the issue 🙂 |
Yes let's consider this solved 🥳 |
Describe the issue
Using a onnxruntime-web with a web bundler like CopyPlugin I am now getting
Package path ./webgpu is not exported from package
. When I manually try to bundle the .wasm's I getUnable to locate '..node_modules/onnxruntime-web/dist/ort-wasm.wasm' glob
.I assume the names changed with this update as I see the web bundling changed. I see now bundling was introduced with dd805ff. I looked for some migration docs but couldn't find any.
To reproduce
Can follow the current quick-start https://github.com/microsoft/onnxruntime-inference-examples/tree/main/js/quick-start_onnxruntime-web-bundler
or
import * as ort from 'onnxruntime-web/webgpu';
bun run dev
I get the error:
Urgency
Not urgent, rolled back to 1.18.0 for now.
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.19.0
Execution Provider
'webgpu' (WebGPU)
The text was updated successfully, but these errors were encountered: