Skip to content
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] warning about the use of eval in Vite #22156

Closed
jclaessens97 opened this issue Sep 19, 2024 · 6 comments
Closed

[Web] warning about the use of eval in Vite #22156

jclaessens97 opened this issue Sep 19, 2024 · 6 comments
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@jclaessens97
Copy link

Describe the issue

Whenever I build with Vite I get the following warning message:

image

To reproduce

  1. Install onnxruntime-web
  2. 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)

@jclaessens97 jclaessens97 added the platform:web issues related to ONNX Runtime web; typically submitted using template label Sep 19, 2024
@fs-eire
Copy link
Contributor

fs-eire commented Sep 19, 2024

The only eval is introduced by dependency protobufjs:
https://github.com/protobufjs/protobuf.js/blob/master/lib/inquire/index.js#L12

@fs-eire
Copy link
Contributor

fs-eire commented Sep 19, 2024

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.

@jclaessens97
Copy link
Author

I tried using wasm import before, but then I get a related issue.

Copy link
Contributor

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.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Oct 20, 2024
@jclaessens97
Copy link
Author

Any update?

@github-actions github-actions bot removed the stale issues that have not been addressed in a while; categorized by a bot label Oct 21, 2024
@fs-eire
Copy link
Contributor

fs-eire commented Oct 22, 2024

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.

@fs-eire fs-eire closed this as completed Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants