nodejs / readable-stream

Node-core streams for userland
https://nodejs.org/api/stream.html
Other
1.03k stars 225 forks source link

`process` is not defined [in default angular app setup] #509

Closed jeswr closed 1 year ago

jeswr commented 1 year ago

Steps to reproduce

# Use defaults for each prompt
npx -p @angular/cli@15.2.2 ng new --name angular-breaking-test
cd angular-breaking-test/
npm i readable-stream@4.3.0
npm i -D @types/readable-stream

Add the following directly below the imports in src/app/app.module.ts

import { Readable } from 'readable-stream';
const readable = new Readable();
readable._read = () => {};
readable.on('data', console.log);
readable.push(null);

Then run npm run start to start the dev environment. The following error is logged to the console Unhandled Promise rejection: process is not defined ; Zone: <root> ; Task: Promise.then ; Value: ReferenceError: process is not defined

The full error is pasted here.

Environment:

Node: v19.3.0
Npm: 9.2.0
Browser: Mozilla Firefox 110.0.1
mcollina commented 1 year ago

The stacktrace is not really helpful. Could you point out where that happens?

@ShogunPanda didn't we got rid of these issues?

jeswr commented 1 year ago

Not at my laptop right now but from memory it was lib/_stream_readable.js

mcollina commented 1 year ago

I feel it might be a problem in your buundler config, as you can see the dependency is there: https://github.com/nodejs/readable-stream/blob/232e71154dbdc34f6a97a0449f902455ec495373/package.json#L50.