safe-buffer in modern build tools like Vitejs
See original GitHub issueHey, i’m trying to use ViteJs for project.
Since this is es6 only, the code errors out inside safe-buffer package Buffer
is undefined here
If we included this simple check, this wouldn’t error out in ViteJs environment.
Is there any reason not to include check like this? If you would be interested, i could submit PR
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:7
Top Results From Across the Web
Issues · feross/safe-buffer - GitHub
Safer Node.js Buffer API. Contribute to feross/safe-buffer development by creating an account on GitHub. ... safe-buffer in modern build tools like Vitejs.
Read more >Uncaught TypeError: Cannot read property 'from' of undefined
I am creating client side app using vitejs bundler and this is the error I am getting: ... safe-buffer in modern build tools...
Read more >Building for Production - Vite
The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the native ES Modules, native ESM dynamic ...
Read more >Vite vs. Snowpack: A comparison of frontend build tools
Frontend build tools like Vite and Snowpack leverage native modules to avoid unnecessary work and keep your project fast.
Read more >Comparison of Build Tools - SurviveJS
Tooling.Report provides a feature comparison of the most popular build tools. ... You can also namespace your scripts using a convention like test:watch...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding buffer to node_modules fixed this for me.
npm i buffer
No need to change the safe-buffer package.
This should absolutely result in a change in
safe-buffer
package.buffer
should be declared as a dep bysafe-buffer
in itspackage.json
if it requires it. I found this problem when I noticed that our bundled output is using any random version ofbuffer
it comes across installed by another dependency, regardless ofbuffer
major versioning. This will lead to insidious and hard to troubleshoot and the dep should be declared bysafe-buffer
.