0

I'm using webpack 4.41.5 and ran npm install d3 --save which installs v5.15.0.

In one of my scripts, I import d3 using:

const d3 = require('d3');

webpack.config.js

//...more imports
const webpack = require('webpack');

module.exports = [{
    //...config stuff

    resolve:{},

    plugins: [
        // ...more modules
        new webpack.ProvidePlugin({ d3: 'd3',})
    ]
}]

I followed these two threads and the resulting error message looks like this:

ERROR in ./node_modules/d3-array/src/index.js
    Module not found: Error: Can't resolve './ascending' in '[work_dir]/node_modules/d3-array/src'
     @ ./node_modules/d3-array/src/index.js 2:0-49 2:0-49
     @ ./node_modules/d3/index.js
     @ ./src/index.js

 ~~ approx 1 billion more errors of the same kind

I also tried this solution because it looked to be the same error, but no luck.

Mimakari
  • 411
  • 3
  • 12

1 Answers1

1

Solved by adding extensions: ['.js'] to the resolve property in webpack.config.js

Mimakari
  • 411
  • 3
  • 12