我正在使用npm install d3 --save
并运行v5.15.0
,它安装了const d3 = require('d3');
。
在我的一个脚本中,我使用以下命令导入d3:
//...more imports
const webpack = require('webpack');
module.exports = [{
//...config stuff
resolve:{},
plugins: [
// ...more modules
new webpack.ProvidePlugin({ d3: 'd3',})
]
}]
webpack.config.js
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
array_count_values()
我也尝试了this solution,因为它看起来是相同的错误,但是没有运气。
答案 0 :(得分:1)
通过在extensions: ['.js']
的{{1}}属性中添加resolve
来解决