-
Notifications
You must be signed in to change notification settings - Fork 9
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
Buffer is undefined when running webpack 5 and angular. #27
Comments
I’m also facing this issue, would adding buffer to the |
thanks @marcelobrito, I read this. however I’m facing the same problem but not with webpack but with vite. adding the mentioned import into |
@marcelobrito @filiphric Just to confirm - are you using the library in the browser? Buffer should be globally defined in Node, but I'm assuming you're packing code for a browser-based implementation? Edit: For context, the cypress-mailosaur plugin should actually get executed 'server-side' (i.e. the |
@hippyhorse yeah it’s executed in browser, but Cypress tests are executed in browser. I’m not sure how would it be possible to execute mailosaur plugin on server side when running in Cypress, can you give me an example of what you have in mind? |
@filiphric Whilst Cypress tests and most commands are executed in the browser, several of the plugin aspects use a Node.js runtime behind the scenes (which is what I believe allowed Buffer to work in our tests here). Either way, we've just pushed version 2.6.0 which has a polyfill that uses Let us know if this works on your side! |
Closing issue as we believe this is now fixed |
The newest iteration of angular does not include Node.js modules in the build, which means Buffer is not included.
This leads to a
Buffer is not defined
error when using til lib.I've fixed it in my build by adding the 'buffer' package and adding
const Buffer = require('buffer/').Buffer;
to request.js
The text was updated successfully, but these errors were encountered: