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

@parcel/resolver-default: Could not load './dist/ort-web.min.js' from module 'onnxruntime-web' found in package.json#browser #19915

Closed
abhijithbabu opened this issue Mar 14, 2024 · 4 comments · Fixed by #20021
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@abhijithbabu
Copy link

Describe the issue

When you using parcel and latest version of onnxruntime-web (1.17.1), I am getting following error

@parcel/resolver-default: Could not load './dist/ort-web.min.js' from module 'onnxruntime-web' found in package.json#browser

seems like package.json has "browser": "dist/ort-web.min.js", which doesn't exist.

Thanks

To reproduce

Use latest version of onnxruntime-web (1.17.1)
and import as below
import {env, InferenceSession, Tensor} from 'onnxruntime-web';

When using parcel to start dev, the error is observed

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.17.1

Execution Provider

Other / Unknown

@abhijithbabu abhijithbabu added the platform:web issues related to ONNX Runtime web; typically submitted using template label Mar 14, 2024
@paramonych
Copy link

paramonych commented Mar 25, 2024

I have exactly the same issue.

After installing the package as described here (tried both ways) :

# install latest release version
npm install onnxruntime-web

# install nightly build dev version
npm install onnxruntime-web@dev

The following error occurs when trying to build the project with parcel, because apparently the required ort-web.min.js is not anywhere near (please find two attached screenshots below).

Removing the "browser" property from the package.json as suggested in #20021 leads me to another error massage related to the "main" property, pointing to another unexisting file, removing which in it's turn, just leads to nothing - ort is just undefined after all:

Could not load './dist/ort-web.node.js' from module 'onnxruntime-web' found in package.json#main

.
Please advice!
.

photo_2024-03-25_11-04-17

photo_2024-03-25_10-55-28

@fs-eire
Copy link
Contributor

fs-eire commented Mar 25, 2024

@paramonych thanks for your feedback. Could you try if this fixes the problem?

fs-eire added a commit that referenced this issue Mar 26, 2024
### Description

Field "browser" is deprecated in favor of "exports". Removes the unused
field.

Some bundler may read from "browser" and generate errors. Removing this
field should let bundler to look up "exports". Fixes #19915
@ex3ndr
Copy link

ex3ndr commented Apr 22, 2024

I have the same problem in React Native project, everything works fine for native apps, but for web it can't resolve modules. Also enabling new exports support is not possible in my project (it breaks a lot of other dependencies)

@fs-eire
Copy link
Contributor

fs-eire commented Apr 22, 2024

I have the same problem in React Native project, everything works fine for native apps, but for web it can't resolve modules. Also enabling new exports support is not possible in my project (it breaks a lot of other dependencies)

could you help to check if adding back the "browser" field to "./dist/ort.min.js" help to fix? If so, I can make another change for adding it back.

fs-eire added a commit that referenced this issue Apr 23, 2024
### Description

As described in latest discussion in #19915, parcel v2 without using the
[new resolver](https://parceljs.org/blog/v2-9-0/#new-resolver) will not
work correctly with onnxruntime-web. There are still users who uses
parcel with default resolver, so add this deprecated field "browser"
back for backward compatibility. This PR also corrects the "main" field,
which is for old resolver for Node.js.
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this issue May 7, 2024
### Description

Field "browser" is deprecated in favor of "exports". Removes the unused
field.

Some bundler may read from "browser" and generate errors. Removing this
field should let bundler to look up "exports". Fixes microsoft#19915
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this issue May 7, 2024
### Description

As described in latest discussion in microsoft#19915, parcel v2 without using the
[new resolver](https://parceljs.org/blog/v2-9-0/#new-resolver) will not
work correctly with onnxruntime-web. There are still users who uses
parcel with default resolver, so add this deprecated field "browser"
back for backward compatibility. This PR also corrects the "main" field,
which is for old resolver for Node.js.
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this issue May 9, 2024
### Description

Field "browser" is deprecated in favor of "exports". Removes the unused
field.

Some bundler may read from "browser" and generate errors. Removing this
field should let bundler to look up "exports". Fixes microsoft#19915
siweic0 pushed a commit to siweic0/onnxruntime-web that referenced this issue May 9, 2024
### Description

As described in latest discussion in microsoft#19915, parcel v2 without using the
[new resolver](https://parceljs.org/blog/v2-9-0/#new-resolver) will not
work correctly with onnxruntime-web. There are still users who uses
parcel with default resolver, so add this deprecated field "browser"
back for backward compatibility. This PR also corrects the "main" field,
which is for old resolver for Node.js.
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

Successfully merging a pull request may close this issue.

4 participants