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
@@ -56,8 +56,18 @@ First let's create a directory, initialize npm, [install webpack locally](/guide
56
56
```bash
57
57
mkdir webpack-demo
58
58
cd webpack-demo
59
+
60
+
# npm
59
61
npm init -y
60
62
npm install webpack webpack-cli --save-dev
63
+
64
+
# yarn
65
+
yarn init -y
66
+
yarn add webpack webpack-cli --dev
67
+
68
+
# pnpm
69
+
pnpm init
70
+
pnpm add webpack webpack-cli -D
61
71
```
62
72
63
73
Throughout the Guides we will use **`diff`** blocks to show you what changes we're making to directories, files, and code. For instance:
@@ -171,7 +181,14 @@ T> You may have noticed that `index.html` was created manually, even though it i
171
181
To bundle the `lodash` dependency with `index.js`, we'll need to install the library locally:
172
182
173
183
```bash
184
+
# npm
174
185
npm install --save lodash
186
+
187
+
# yarn
188
+
yarn add lodash
189
+
190
+
# pnpm
191
+
pnpm add lodash
175
192
```
176
193
177
194
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).
@@ -222,7 +239,15 @@ In this setup, `index.js` explicitly requires `lodash` to be present, and binds
222
239
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