-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 can't use web3.js , Uncaught ReferenceError: global is not defined #3816
Comments
This doesn't look like a feature(/enhancement) request 👀 Maybe this is also a duplicate and already resolved via #2618 (comment) So I will close this for now and please open a bug issue if you have further problems |
after you have added added the global shim to the head of your html file you will most likely see error from more node specific dependencies which you should be able to solve like this vite.config.js import { defineConfig } from 'vite'
import polyfillNode from 'rollup-plugin-polyfill-node'
export default defineConfig({
plugins: [
polyfillNode()
],
optimizeDeps: {
exclude: ['dragula'] // <- modules that needs shimming have to be excluded from dep optimization
}
}) |
Vite users: please do not ignore issue templates in other repositories. |
This issue has been locked since it has been closed for more than 14 days. If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion. |
when i use web3 in vite project ,
it can be used in vue-cli ,how can I fix it ?
The text was updated successfully, but these errors were encountered: