title: How can I use csv-parse in Angular?
body: <p>I was using <a href="https://www.npmjs.com/package/csv-parse" rel="nofollow noreferrer">csv-parse</a> succesfully in a Vue project.
  The code looks like this:</p>
  
  <pre><code>import * as csvParse from 'csv-parse';
  const parse = require('csv-parse')
  
  const parseOptions: csvParse.Options = {
      //options here...
  };
  
  var parser: csvParse.Parser = csvParse(parseOptions, function(data, err) {
      console.log(data);
  }) as csvParse.Parser;
  
  const parseCallback:csvParse.Callback = (err: Error|undefined, records: any, info: csvParse.Info) =&gt; 
  {
      //code to run after parse...
  };
  parse(csvText, parseOptions, parseCallback);
  </code></pre>
  
  <p>We switched to Angular 8 and the same code started raising this error:</p>
  
  <pre><code>index.js:43 Uncaught ReferenceError: global is not defined
      at Object../node_modules/buffer/index.js (index.js:43)
      at __webpack_require__ (bootstrap:79)
      at Object../node_modules/safe-buffer/index.js (index.js:2)
      at __webpack_require__ (bootstrap:79)
      at Object../node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:55)
      at __webpack_require__ (bootstrap:79)
      at Object../node_modules/readable-stream/readable-browser.js (readable-browser.js:1)
      at __webpack_require__ (bootstrap:79)
      at Object../node_modules/stream-browserify/index.js (index.js:28)
      at __webpack_require__ (bootstrap:79)
  </code></pre>
  
  <p>I added </p>
  
  <pre><code>declare function require(path: string): any;
  </code></pre>
  
  <p>to handle require in typescript.
  I also tried removing the require. I get the same error.</p>
  
  <p>How can I fix this? Thanks.</p>