You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is a bug in Vite or the @ensdomains/address-encoder package. In our case, we're using bnc-onboard which has an indirect dependency on @ensdomains/address-encoder.
When bundling with Webpack, this worked fine. After migration to Vite, we receive:
It appears that the bundled code relies on node's crypto module. The workaround is to add this alias entry in our Vite config:
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
I assume you used webpack 4. Webpack 4 polyfills node builtins by default.
Vite doesn't/won't polyfill node builtins for the browser but can be polyfilled with aliasses. you can use the package the ssr mode on the server
you are getting the warning because the library you are using haven't exported a browser friendly version.
libraries should preferably not be using node builtins.
if a library exports esm format it works best if all its dependencies also have esm export
vite is using index.module.js as its specified for the module export
the library could be more specific for environment target by using package entry points
Describe the bug
I don't know if this is a bug in Vite or the @ensdomains/address-encoder package. In our case, we're using bnc-onboard which has an indirect dependency on @ensdomains/address-encoder.
When bundling with Webpack, this worked fine. After migration to Vite, we receive:
It appears that the bundled code relies on node's crypto module. The workaround is to add this alias entry in our Vite config:
"@ensdomains/address-encoder": "@ensdomains/address-encoder/lib/index.umd.js"
So that the web-oriented bundle is used instead.
If you see this as an issue with @ensdomains/address-encoder, let me know and I can file an issue in that repo. Thank you!
Reproduction
I believe enough information is provided. Let me know if not.
System Info
Used Package Manager
npm
Logs
I'm just including the last part that may pertain to this issue.
Validations
The text was updated successfully, but these errors were encountered: