-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix(optimizer): browser field bare import (fix #7599) #10314
fix(optimizer): browser field bare import (fix #7599) #10314
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks
"version": "0.0.0", | ||
"main": "index.js", | ||
"browser": { | ||
"events": "./events-shim.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a note to anyone else who's equally as curious in the future as me, this is the "bare id mapping" in the browser
field.
Hi, I am having a problem with the browser field still. When I import @xenova/transformers, it is trying to import the node modules of onnxruntime-node and sharp, which are native node modules and should not be imported in the browser. When they are imported, it creates a lot of errors due to missing node modules. The browser field in package.json of https://github.com/xenova/transformers.js specifically states false for these modules and they should be ignored when running @xenova/transformers in the browser. Is there any way to fix this? |
Description
Closes #7599
fixes #4798
fixes #7301
fixes #7576
Additional context
Make vite correctly resolve bare imports with browser field
In #8706 @sapphi-red mentioned we need to
instead of the way in #8709
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).