Установка Lodash

$ npm init -y
$ npm install --save-dev webpack webpack-cli


С использованием WebPack

$ npm install lodash


index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="bundle.js"></script>
    <title>Lodash</title>
  </head>
  <body>
    <h1>Hi lodash</h1>
  </body>
</html>


main.js

import _ from 'lodash';
console.log('Hello, lodash!', _.isEmpty([]));
console.log('Lodash Version!', _.VERSION);


https://webpack.js.org/guides/getting-started/


webpack.config.js


const path = require('path');

module.exports = {
  entry: './main.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname),
  },
};


package.json

***

"scripts": {
    "webpack": "webpack"
  },

***


$ npm run webpack


Без использования WebPack


$ wget https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.20/lodash.js


index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="lodash.js"></script>
    <script src="main.js"></script>
    <title>Lodash</title>
  </head>
  <body>
    <h1>Hi lodash</h1>
  </body>
</html>


main.js

console.log('Hello, lodash!', _.isEmpty([]));