1

I am moderately new to webpack and have been struggling with this for a while, and need some help.

This repo: github.com/gkindel/CSV-JS

I cannot get to be built with webpack. It throws the error:

WARNING in ./bower_components/CSV-JS/csv.js
Critical dependencies:
203:20-27 require function is used in a way in which dependencies cannot be statically extracted

Here is how I try to use it:

// CSV-JS used by angular ui-grid CSV importer
window.CSV = require('../bower_components/CSV-JS');

The line it is failing on looks like this:

 CSV.stream = function () {
    var s = new require('stream').Transform({objectMode: true});
    ...

I am pretty sure ui-grid does not use this function in the library, but webpack has to parse the entire file. I am guessing this is functionality to use in a node environment.

Anyway, anyone have a way of loading this dependency? Or perhaps an alternative library? (not sure if this is possible though, because ui-grid depends on the CSV.parse() function).

kevinrstone
  • 266
  • 2
  • 12
  • I am facing the same problem.. How did you solve it ? – vaishali Dec 13 '17 at 10:14
  • I did not solve it. I placed a copy of the file in our repository (which is not ideal). In the file I manually removed the `CSV.stream` functions that were causing webpack to fail. – kevinrstone Dec 14 '17 at 17:23

0 Answers0