# How to use lodash at the same time with the underscore along on the same web page

**URL:** <https://www.virtocommerce.org/t/how-to-use-lodash-at-the-same-time-with-the-underscore-along-on-the-same-web-page/266>\
**Category:** howto\
**Created:** [November 5, 2020, 2:50pm UTC](https://www.virtocommerce.org/t/how-to-use-lodash-at-the-same-time-with-the-underscore-along-on-the-same-web-page/266 "2020-11-05T14:50:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatarincev](https://yyz2.discourse-cdn.com/flex032/user_avatar/www.virtocommerce.org/tatarincev/32/161_2.png) [@tatarincev](https://www.virtocommerce.org/u/tatarincev)\
**Post date:** [November 5, 2020, 2:50pm UTC](https://www.virtocommerce.org/t/how-to-use-lodash-at-the-same-time-with-the-underscore-along-on-the-same-web-page/266/1 "2020-11-05T14:50:31Z")

</div>

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 into `package.json` of your module  

- run `npm install` ​ - to install `lodash` 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 from `lodash` package  
 ![image](https://canada1.discourse-cdn.com/flex032/uploads/virtocommerce/original/1X/ff1fbe4da5fbee3b7b0af9fe6ec514a191ea9df3.png)

- `run npm run webpack:dev` ​ - to build and bundle scripts

- enjoy 🙂
