You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/guides/getting-started.mdx
+42-3Lines changed: 42 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,18 @@ First let's create a directory, initialize npm, [install webpack locally](/guide
43
43
```bash
44
44
mkdir webpack-demo
45
45
cd webpack-demo
46
+
47
+
# npm
46
48
npm init -y
47
49
npm install webpack webpack-cli --save-dev
50
+
51
+
# yarn
52
+
yarn init -y
53
+
yarn add webpack webpack-cli --dev
54
+
55
+
# pnpm
56
+
pnpm init
57
+
pnpm add webpack webpack-cli -D
48
58
```
49
59
50
60
Throughout the Guides we will use **`diff`** blocks to show you what changes we're making to directories, files, and code. For instance:
@@ -158,7 +168,14 @@ T> You may have noticed that `index.html` was created manually, even though it i
158
168
To bundle the `lodash` dependency with `index.js`, we'll need to install the library locally:
159
169
160
170
```bash
171
+
# npm
161
172
npm install --save lodash
173
+
174
+
# yarn
175
+
yarn add lodash
176
+
177
+
# pnpm
178
+
pnpm add lodash
162
179
```
163
180
164
181
T> When installing a package that will be bundled into your production bundle, you should use `npm install --save`. If you're installing a package for development purposes (e.g. a linter, testing libraries, etc.) then you should use `npm install --save-dev`. More information can be found in the [npm documentation](https://docs.npmjs.com/cli/install).
@@ -209,7 +226,15 @@ In this setup, `index.js` explicitly requires `lodash` to be present, and binds
209
226
With that said, let's run `npx webpack` from the project root. If webpack is installed locally, `npx` will run the local binary from `node_modules/.bin`; otherwise, it may download and execute it. This command takes our script at `src/index.js` as the [entry point](/concepts/entry-points) and generates `dist/main.js` as the [output](/concepts/output).
0 commit comments