I\'m trying to use lodash in my web application. I have installed lodash using npm in my local project.
I plan on using the ES6 modules in my code.
Here is
Try module lodash-es
import each from '../node_modules/lodash-es/each.js'
If you don't wish to use any bundling tools, you will need to provide a path to the lodash folder within node_modules
, relative to the JavaScript file that you have the import statement in.
If you do not wish to use a bundler, it would also be worthwhile importing from the specific file, the function you need. For example:
import _each from '../node_modules/lodash/each'
Eventually you can't use JS modules on browser like that. These modules are for webpack or other bundler.