Reputation: 449
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.
Upvotes: 0
Views: 1005
Reputation: 449
Solved by adding extensions: ['.js']
to the resolve
property in webpack.config.js
Upvotes: 1