vite: vite use web3.js throw Uncaught ReferenceError: process is not defined
To solve the problem "global is not defined "
import { defineConfig, UserConfigExport, ConfigEnv } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path'; import polyfillNode from 'rollup-plugin-polyfill-node' export default defineConfig({ plugins: [ vue(), polyfillNode() ], optimizeDeps: { exclude: ['dragula'] } })
and then throw Uncaught ReferenceError: process is not defined, problem .
so How can I fix it? thanks!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 21 (5 by maintainers)
added to head html file
vite.config.ts
add these dependencies
browserify-zlib
,events
,process
,stream-browserify
,util
have created a pull request to your reproduction showing working dev and build for me
You are so cool.