-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
vite does not handle "browser" field in package.json properly, when using package 'tapable' #7576
Comments
seems like vite got wrong id from esbuild The |
Another question: |
I believe I have a similar problem when using the package websocket-stream (directly, or through aws-iot-device-sdk). |
Does Vite not care about the browser field at all maybe? |
Run into a similar issue, when package defines inside {
"browser": {
"dependency": false
}
} |
I'm trying to build Vite project with a @polkadot/rpc-provider package which has @substrate/smoldot-light deep down below.
|
I have similar problem with xrpl.js which uses https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/package.json#L20-L22 A workaround of putting an alias for it manually works (in your vite.config.js): resolve: {
alias: {
// your other aliases
// ...
ws: './node_modules/xrpl/dist/npm/client/WSWrapper.js'
}
}, Seems like there is a PR for it #8709 |
Does this fix is in |
Describe the bug
Just install npm package
tapable
, and import it inmain.js
Then the console will print an error:
Then I digged into
node_modules/tapable/package.json
, and it usebrowser
field for different platforms.and package
util
is imported intapable/lib/Hook.js Line 7
So In expected result, I will get the file
util-browser
involved, which described inbrowser
. But actually the pre-bundled code just resolved this into some compatibility code.So how can I solve this?
Reproduction
https://stackblitz.com/edit/vitejs-vite-6grfch?file=main.js
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: