To use lodash at the same time as the underscore you need to do some dirty tricks because both libraries share the same global variable _
-
Need to add
lodash
dependency intopackage.json
of your module
-
run
npm install
- to installlodash
npm package -
add to the
webpack.config.js
the following lines
-
In the main js file of your module add this line
_.noConflict()
. This line is required to restore global variable _ for underscore package to do not affect existing js code.
-
Use
_lodash
global variable instead of _ for call functions fromlodash
package
-
run npm run webpack:dev
- to build and bundle scripts -
enjoy