node-csv-stringify icon indicating copy to clipboard operation
node-csv-stringify copied to clipboard

Error happened when using csv-stringify/lib/es5

Open alixiashu opened this issue 4 years ago • 3 comments

Describe the bug

When I try to use csv-stringify/lib/es5 to stringify an array, there is an error happened and csvStringify couldn't catch the error.

The error message: _stream_readable.js:824 Uncaught (in promise) ReferenceError: process is not defined at Stringifier.push.../../node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js.Readable.on (_stream_readable.js:824) at stringify (index.js:737)

To Reproduce

I just use the code below: csvStringify( [{a: '1'}], { header: true, columns: [{key: 'a'}] }, (e,output) => { console.log(e+output) } )

It will directly throw the error, csvStringify couldn't catch the error and put it in the csvStringify.Callback

Additional context

  1. IE11 didn't support csv-stringify/lib/browser, that's why I used csv-stringify/lib/es5;
  2. Package version: 5.6.1

alixiashu avatar Feb 19 '21 07:02 alixiashu

It is a question of webpack5. Details: https://stackoverflow.com/questions/65018431/webpack-5-uncaught-referenceerror-process-is-not-defined

alixiashu avatar Feb 19 '21 12:02 alixiashu

I think we need a combination of browser and es5. Let me have a look.

wdavidw avatar Feb 22 '21 15:02 wdavidw

Could you try ./lib/browser again with version 5.6.2 that was just published, it is now compatible with ES5 (older browser).

wdavidw avatar Feb 22 '21 15:02 wdavidw