Lodash module not found + webpack

吃可爱长大的小学妹 提交于 2020-07-22 05:18:36

问题


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

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

I import the library as:

import _ from 'lodash';

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
]

and this is my package json dependencies:


回答1:


Running npm install will solve your error!



来源:https://stackoverflow.com/questions/47110025/lodash-module-not-found-webpack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!