vite: vue3+vite reports Uncaught ReferenceError: Buffer is not defined
Describe the bug
version: “vue”: “^3.2.16”, “vite”: “^2.6.4”
Buffer is used for data conversion in the vue3+vite project, and the running project reports Uncaught ReferenceError: Buffer is not defined
Reproduction
The project git repository is: https://github.com/LQS5858/newmall-vue3-vite
System Info
System:
OS: macOS 11.6
CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Memory: 351.83 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.4 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.15 - /usr/local/bin/npm
Browsers:
Safari: 14.1.2
Used Package Manager
npm
Logs
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (5 by maintainers)
@javastation thank u it worked https://unruffled-jepsen-863a3f.netlify.app/
hmm thank u. I totally forgot about the prebuilt version. Lemme try it
Maybe it’s a problem with web3, you can try this in
vite.config.ts
:resolve: { alias: { web3: path.resolve(__dirname, './node_modules/web3/dist/web3.min.js') }, }