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
Open up `dist/index.html` in your browser again and you should see that `Hello webpack` is now styled in red. To see what webpack did, inspect the page (don't view the page source, as it won't show you the result, because the `<style>` tag is dynamically created by JavaScript) and look at the page's head tags. It should contain the style block that we imported in `index.js`.
If all went well, you should now see your icon as a repeating background, as well as an `img` element beside our `Hello webpack` text. If you inspect this element, you'll see that the actual filename has changed to something like `29822eaa871e8eadeaa4.png`. This means webpack found our file in the `src` folder and processed it!
Now open the resulting `index.html` file in your browser. Click the button and look in your console where the error is displayed. The error should say something like this:
@@ -171,12 +171,12 @@ Let's add an npm script that will start webpack's Watch Mode:
171
171
"author": "",
172
172
"license": "ISC",
173
173
"devDependencies": {
174
-
"html-webpack-plugin": "^5.0.0",
175
-
"webpack": "^5.4.0",
176
-
"webpack-cli": "^6.0.0"
174
+
"html-webpack-plugin": "^5.6.6",
175
+
"webpack": "^5.105.0",
176
+
"webpack-cli": "^7.0.0"
177
177
},
178
178
"dependencies": {
179
-
"lodash": "^4.17.20"
179
+
"lodash": "^4.17.21"
180
180
}
181
181
}
182
182
```
@@ -273,13 +273,13 @@ Let's add a script to easily run the dev server as well:
273
273
"author": "",
274
274
"license": "ISC",
275
275
"devDependencies": {
276
-
"html-webpack-plugin": "^5.0.0",
277
-
"webpack": "^5.4.0",
278
-
"webpack-cli": "^6.0.0",
279
-
"webpack-dev-server": "^5.0.0"
276
+
"html-webpack-plugin": "^5.6.6",
277
+
"webpack": "^5.105.0",
278
+
"webpack-cli": "^7.0.0",
279
+
"webpack-dev-server": "^5.2.3"
280
280
},
281
281
"dependencies": {
282
-
"lodash": "^4.17.20"
282
+
"lodash": "^4.17.21"
283
283
}
284
284
}
285
285
```
@@ -399,15 +399,15 @@ Now add an npm script to make it a little easier to run the server:
399
399
"author": "",
400
400
"license": "ISC",
401
401
"devDependencies": {
402
-
"express": "^4.17.1",
403
-
"html-webpack-plugin": "^5.0.0",
404
-
"webpack": "^5.4.0",
405
-
"webpack-cli": "^6.0.0",
406
-
"webpack-dev-middleware": "^4.0.2",
407
-
"webpack-dev-server": "^5.0.0"
402
+
"express": "^5.2.1",
403
+
"html-webpack-plugin": "^5.6.6",
404
+
"webpack": "^5.105.0",
405
+
"webpack-cli": "^7.0.0",
406
+
"webpack-dev-middleware": "^8.0.3",
407
+
"webpack-dev-server": "^5.2.3"
408
408
},
409
409
"dependencies": {
410
-
"lodash": "^4.17.20"
410
+
"lodash": "^4.17.21"
411
411
}
412
412
}
413
413
```
@@ -425,12 +425,12 @@ Example app listening on port 3000!
Copy file name to clipboardExpand all lines: src/content/guides/getting-started.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Webpack is a good fit when your application needs a customizable build pipeline:
34
34
35
35
Webpack is used to efficiently compile JavaScript modules. Once [installed](/guides/installation), you can interact with webpack either from its [CLI](/api/cli) or [API](/api/node). If you're still new to webpack, please read through the [core concepts](/concepts) and [this comparison](/comparison) to learn why you might use it over the other tools that are out in the community.
36
36
37
-
W> The minimum supported Node.js version to run webpack 5 is 10.13.0 (LTS)
37
+
W> The examples in this guide use `webpack-cli` 7, which requires Node.js 20.9.0 or later.
We can see that webpack generates our `print.bundle.js` and `index.bundle.js` files, which we also specified in our `index.html` file. if you open `index.html` in your browser, you can see what happens when you click the button.
If you open `index.html` in your code editor, you'll see that the `HtmlWebpackPlugin` has created an entirely new file for you and that all the bundles are automatically added.
We can also use the `ProvidePlugin` to expose a single export of a module by configuring it with an "array path" (e.g. `[module, child, ...children?]`). So let's imagine we only wanted to provide the `join` method from `lodash` wherever it's invoked:
0 commit comments