我尝试使用库ladash,但我收到了下一个错误:
Module not found: Error: Can't resolve 'lodash' in
我将库导入为:
import _ from 'lodash';
这是webpack配置:
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/,
options: {
plugins: ['lodash'],
presets: [['env', { modules: false, targets: { node: 4 } }]]
}
}
......
......
plugins: [
new LodashModuleReplacementPlugin,
new webpack.optimize.UglifyJsPlugin
]
这是我的包json依赖项:
答案 0 :(得分:1)
运行npm install
将解决您的错误!