diff --git a/src/content/concepts/index.mdx b/src/content/concepts/index.mdx index 6657460d2e15..7ab7f8c465f8 100644 --- a/src/content/concepts/index.mdx +++ b/src/content/concepts/index.mdx @@ -138,18 +138,21 @@ In order to use a plugin, you need to `import` it and add it to the `plugins` ar **webpack.config.js** ```js -import HtmlWebpackPlugin from "html-webpack-plugin"; import webpack from "webpack"; // to access built-in plugins export default { + entry: "./src/index.html", + experiments: { + html: true, + }, module: { rules: [{ test: /\.js$/, use: "babel-loader" }], }, - plugins: [new HtmlWebpackPlugin({ template: "./src/index.html" })], + plugins: [new webpack.ProgressPlugin()], }; ``` -In the example above, the `html-webpack-plugin` generates an HTML file for your application and automatically injects all your generated bundles into this file. +In the example above, the `ProgressPlugin` customizes how build progress is reported. Your `src/index.html` is the entry: webpack bundles the scripts and styles it references and rewrites those URLs to the built filenames, so no plugin is needed to produce the page — see [Native HTML](/guides/native-html/). T> There are many plugins that webpack provides out of the box! Check out the [list of plugins](/plugins). diff --git a/src/content/concepts/loaders.mdx b/src/content/concepts/loaders.mdx index 407fe23aea24..8d7232350e04 100644 --- a/src/content/concepts/loaders.mdx +++ b/src/content/concepts/loaders.mdx @@ -44,7 +44,7 @@ export default { }; ``` -T> Plain `.css` files need no loader at all: webpack parses, extracts and minifies CSS itself — see [`experiments.css`](/configuration/experiments/#experimentscss) and the [Native CSS](/guides/native-css/) guide. A preprocessor still needs its loader, and `type: 'css/auto'` hands what the loader produces to webpack's CSS pipeline. +T> Plain `.css` files need no loader at all: webpack has experimental built-in CSS support that parses, extracts and minifies CSS itself — see [`experiments.css`](/configuration/experiments/#experimentscss) and the [Native CSS](/guides/native-css/) guide. A preprocessor still needs its loader, and `type: 'css/auto'` hands what the loader produces to webpack's CSS pipeline. ## Using Loaders diff --git a/src/content/concepts/plugins.mdx b/src/content/concepts/plugins.mdx index 1df8c6c7b218..b163bc68dfcc 100644 --- a/src/content/concepts/plugins.mdx +++ b/src/content/concepts/plugins.mdx @@ -52,14 +52,16 @@ Depending on how you are using webpack, there are multiple ways to use plugins. ```js import path from "node:path"; import { fileURLToPath } from "node:url"; -import HtmlWebpackPlugin from "html-webpack-plugin"; import webpack from "webpack"; // to access built-in plugins const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); export default { - entry: "./path/to/my/entry/file.js", + entry: "./src/index.html", + experiments: { + html: true, + }, output: { filename: "my-first-webpack.bundle.js", path: path.resolve(__dirname, "dist"), @@ -72,14 +74,11 @@ export default { }, ], }, - plugins: [ - new webpack.ProgressPlugin(), - new HtmlWebpackPlugin({ template: "./src/index.html" }), - ], + plugins: [new webpack.ProgressPlugin()], }; ``` -The `ProgressPlugin` is used to customize how progress should be reported during compilation, and `HtmlWebpackPlugin` will generate a HTML file including the `my-first-webpack.bundle.js` file using a `script` tag. +The `ProgressPlugin` is used to customize how progress should be reported during compilation. `src/index.html` is the entry, so webpack emits it as the page with the `