Skip to content

#onnxruntime-webgpu alias does not resolve for parcel #986

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

Closed
1 of 5 tasks
PoorRican opened this issue Oct 23, 2024 · 3 comments · Fixed by #1075
Closed
1 of 5 tasks

#onnxruntime-webgpu alias does not resolve for parcel #986

PoorRican opened this issue Oct 23, 2024 · 3 comments · Fixed by #1075
Labels
bug Something isn't working

Comments

@PoorRican
Copy link

System Info

"@huggingface/transformers": "^3.0.0",
"@parcel/config-webextension": "^2.9.3",
"parcel": "^2.9.3",

Environment/Platform

  • Website/web-app
  • Browser extension
  • Server-side (e.g., Node.js, Deno, Bun)
  • Desktop app (e.g., Electron)
  • Other (e.g., VSCode extension)

Description

The following error is returned when attempting to build the webextension:

@parcel/core: Failed to resolve '#onnxruntime-webgpu' from './node_modules/@huggingface/transformers/src/backends/onnx.js'

  .../node_modules/@huggingface/transformers/src/backends/onnx.js:29:27
    28 | // @ts-ignore
  > 29 | import * as ONNX_WEB from '#onnxruntime-webgpu';

Overwriting the import to onnxruntime-web fixes the issue.

Reproduction

  1. Create project with parcel, @parcel/config-webextension, and @huggingface/transformers.
  2. Create basic manifest.json
  3. Create a file which imports from @huggingface/transformers
  4. Run parcel build ./src/manifest.json
@PoorRican PoorRican added the bug Something isn't working label Oct 23, 2024
@xenova
Copy link
Collaborator

xenova commented Oct 23, 2024

Hi there! 👋 Can you confirm this is maybe not a bug with Parcel itself? If there is a missing configuration mapping I can put in the package.json, there I'd be happy to!

@devnook
Copy link

devnook commented Oct 24, 2024

I think you need to add

"@parcel/resolver-default": {
    "packageExports": true
  }

in your package.json to enable subpaths in Parcel.

@xenova
Copy link
Collaborator

xenova commented Oct 24, 2024

Thanks @devnook! This looks like what we need. parcel-bundler/parcel#7840 (comment) also recommends this approach (docs here).

@PoorRican does this work for you? I also think we should create an example application in https://github.com/huggingface/transformers.js-examples for this too. If either of you are interested, feel free to open a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants