[Web] warning about the use of eval in Vite
Describe the issue
Whenever I build with Vite I get the following warning message:
To reproduce
- Install onnxruntime-web
- Build application with Vite
Urgency
No response
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.19.2
Execution Provider
'webgl' (WebGL)
The only eval is introduced by dependency protobufjs:
https://github.com/protobufjs/protobuf.js/blob/master/lib/inquire/index.js#L12
We still need protobufjs if using WebGL.
If using CPU only, you can import onnxruntime-web/wasm
If using WebGPU, you can import onnxruntime-web/webgpu
They both do not depend on protobufjs and there should be no eval() in the corresponding bundles.
I tried using wasm import before, but then I get a related issue.
This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.
Any update?
The "use of eval" warning will exist for a while until WebGL backend is eventually go out of lifetime and be replaced by WebGPU.
The specific code that uses "eval" is from protobuf.js to ensure the call to require() is not preprocessed by bundlers. Technically it does not get called in a web environment so it should be pretty much fine.
I will close this issue because there is no further action item. Will revisit the other issue when I get some time.
If people are having problems importing /webgpu or /wasm in a chrome plugin, it can be solved with webpack. Please see my solution in this related issue.