You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using this package in browsers despite not using streams, I'm getting errors since Buffer and process are not defined in this environment.
ReferenceError: Buffer is not defined
at node_modules/duplexify/index.js (index.js:6:21)
at __require2 (chunk-62VDRKYJ.js?v=80dff520:19:50)
at node_modules/pumpify/index.js (index.js:3:17)
at __require2 (chunk-62VDRKYJ.js?v=80dff520:19:50)
at node_modules/minify-xml/index.js (index.js:244:17)
at __require2 (chunk-62VDRKYJ.js?v=80dff520:19:50)
at dep:minify-xml:1:16
This is because this package uses duplexify and pumpify packages, which require the Buffer class and the process object.
Is there a possibility for a browser-compatible version? My project has a lot of workers and to fix this issue I have to do weird things like this:
import { Buffer } from 'buffer';
(window as any).Buffer = Buffer;
(window as any).process = { version: 'browser' };
I'm aware there are other workarounds like polyfills, Vite plugins and other solutions, unfortunately they are not always fully reliable.
Please consider including browser-friendly export for this great library.
The text was updated successfully, but these errors were encountered:
Mhm good idea, but definitely nothing "short term" on my agenda. If you want to suggest how to do this via a PR, please feel free. But atm. I don't think I will find the time to provide you a change that will suit your needs. This is mainly a NodeJS library and used e.g. in the Chromium project, so running in a browser, whilst I like the idea, is not a main priority for the library atm. Sorry.
I will flag this issue appropriately and if anyone wants to come up with a good suggestion in this direction, I will be happy to review / support.
While using this package in browsers despite not using streams, I'm getting errors since Buffer and process are not defined in this environment.
This is because this package uses duplexify and pumpify packages, which require the Buffer class and the process object.
Is there a possibility for a browser-compatible version? My project has a lot of workers and to fix this issue I have to do weird things like this:
I'm aware there are other workarounds like polyfills, Vite plugins and other solutions, unfortunately they are not always fully reliable.
Please consider including browser-friendly export for this great library.
The text was updated successfully, but these errors were encountered: