-
Notifications
You must be signed in to change notification settings - Fork 843
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
Could not read from file: D:\vite-project\node_modules\stream-browserify\web #742
Comments
I think I should be able to just remote that import (since we don't support node < 18 anymore). |
#752 should fix this. |
Hi I'm having a problem when importing @xenova/transformers in vite. Basically it's trying to import onnxruntime-node and sharp, which are not supposed to be imported as they are native modules, and this is causing all sorts of errors. I have also tried to ask here: vitejs/vite#10314 (comment) I've tried adding vite-plugin-node-polyfills and have removed it as it did not seem to help the errors. @bekatan and @jzyzxx, do you know how to get @xenova/transformers working in a vite project? |
@customautosys The default vite settings should be able to ignore these by looking at the package.json's browser field. Could you provide more information about your environment? See here for an example: https://github.com/xenova/transformers.js/tree/main/examples/depth-anything-client |
I am using https://github.com/quasarframework/quasar I asked them and they said the cache for the node_modules is built by Vite and it's not something Quasar does. I don't know why Vite seems to be ignoring the browser field. I've tried Vite versions 3, 4 and 5 and nothing works. I couldn't find anything in the Vite documentation about any flag controlling whether the browser field is ignored. |
Hi @xenova, sorry to have bothered you. I solved this problem by upgrading @quasar/app-vite to ^2.0.0-beta.12 and vite to ^5.2.10. Thanks anyway! |
System Info
os:win11
node version:v21.6
npm config:
Environment/Platform
Description
When i import the pipeline module,the above error accured
import { pipeline } from "@xenova/transformers";
Reproduction
When i import the pipeline module,the above error accured
import { pipeline } from "@xenova/transformers";
The text was updated successfully, but these errors were encountered: