ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
To install the latest release or a specific version, run one of the following commands: ~~~bash npm install --save-dev webpack npm install --save-dev webpack@<version> ~~~ If you're using webpack v4 or later, you'll also need to install the [CLI](https://webpack.js.org/api/cli/). ~~~bash npm install --save-dev webpack-cli ~~~ 1. Create a directory `webpack-demo`, initialize npm, install webpack locally, and install the webpack-cli (the tool used to run webpack on the command line) locally: ~~~bash mkdir webpack-demo cd webpack-demo npm init -y npm install webpack --save-dev npm install webpack-cli --save-dev ~~~ >[info] When installing a package that will be bundled into your production bundle, you should use `npm install --save`, `package.json->"dependencies"`. > If you're installing a package for development purposes (e.g. a linter, testing libraries, etc.) then you should use `npm install --save-dev`, `package.json->"devDependencies"` package.json: ~~~ { "name": "webpack-demo", "version": "1.0.0", "description": "", "private": true, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "webpack": "^4.35.2", "webpack-cli": "^3.3.5" } } ~~~ 2. Install `lodash` ~~~bash npm install --save lodash ~~~ package.json: ~~~ { "dependencies": { "lodash": "^4.17.11" } } ~~~ use `lodash` in `./src/index.js` file ~~~ const _ = require('lodash'); import _ from 'lodash'; ~~~