找不到Lodash模块+ Webpack [英] Lodash module not found + webpack

查看:148
本文介绍了找不到Lodash模块+ Webpack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Ladash库,但出现下一个错误:

I try use the library ladash but I´m getting the next error:

Module not found: Error: Can't resolve 'lodash' in

我将库导入为:

import _ from 'lodash';

这是webpack配置:

This is the webpack config:

{
  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依赖项:

and this is my package json dependencies:

推荐答案

运行 npm install 将解决您的错误!

这篇关于找不到Lodash模块+ Webpack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆