Skip to content
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

"new SlowBuffer" is deprecated since Node v.6 --> cannot use it with VITE5 and VUE3 #449

Closed
Patrice-expleo opened this issue Feb 2, 2024 · 2 comments · Fixed by #456
Closed

Comments

@Patrice-expleo
Copy link

Hi everybody,

I am updating my project from VITE4 to VITE5 using your library.
Compilation is correct but in the browser got the error message:
Uncaught TypeError: SlowBuffer is not a function

When I look at the stacktrace I can see you are using new SlowBuffer(1024) for var TAP. This call is deprecated since version 6 of node.

Is there a possibility for a workaround or a fix? The fix would be done very fast, cause you can use Buffer.allocUnsafeSlow instead.

I already was importing vite-plugin-node-polyfills, but that does not resolve the error.

Best regards

@mtth
Copy link
Owner

mtth commented Feb 13, 2024

Your suggested fix sounds good; I'll include it in the upcoming 6.x release.

Before I backport it to 5.x - does this allow you to work around the issue?

const buffer = require('buffer');
buffer.SlowBuffer = buffer.Buffer;

@Patrice-expleo
Copy link
Author

Thanks for the reply. In my case, setting the Buffer flag of vitePolyfills (in vite.config) to false will be the workaround. It is true for default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants