Skip to content

Commit 42ff719

Browse files
authored
fix(docs): resolve few more guide TODOs links and fixed warning tags (#168)
docs: resolve guide TODO links and fixed warning tags
1 parent da2df49 commit 42ff719

11 files changed

Lines changed: 58 additions & 15 deletions

File tree

pages/blog/posts/2020-10-10-webpack-5-release.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,8 @@ As webpack 5 differs between different issuing dependencies so it might make sen
819819

820820
## Major Internal Changes
821821

822-
?> This section might need a bit more refinement
822+
> [!NOTE]
823+
> This section might need a bit more refinement
823824
824825
The following changes are only relevant for plugin authors:
825826

pages/blog/posts/2020-12-08-roadmap-2021.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ Currently I'm not yet sure if this is worth it, but it's at least worth looking
8585
Currently it's not possible to generate ESM exports for a bundle via `output.library.type: "module"`.
8686
This can be useful when integrating webpack bundles into ESM loading environments or inline scripts.
8787

88-
T> For webpack 4 there is actually a plugin, but native support would be preferable.
88+
> [!TIP]
89+
> For webpack 4 there is actually a plugin, but native support would be preferable.
8990
9091
#### ESM externals (import)
9192

@@ -112,7 +113,8 @@ export default {
112113
};
113114
```
114115

115-
W> Using multiple different ESM CDNs will not work. This is only an example.
116+
> [!WARNING]
117+
> Using multiple different ESM CDNs will not work. This is only an example.
116118
117119
#### ESM library
118120

pages/blog/posts/2026-04-08-webpack-5-106.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ module.exports = {
9999
};
100100
```
101101

102-
W> CSS support has matured significantly and is expected to be fully finalized in the next minor release, as planned in the roadmap. As part of this transition, `css-loader`, `style-loader`, and `mini-css-extract-plugin` are planned for deprecation.
102+
> [!WARNING]
103+
> CSS support has matured significantly and is expected to be fully finalized in the next minor release, as planned in the roadmap. As part of this transition, `css-loader`, `style-loader`, and `mini-css-extract-plugin` are planned for deprecation.
103104
104105
## Better Tree Shaking for CommonJS Destructuring
105106

pages/blog/posts/2026-05-19-webpack-5-107.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ Explore what's new:
4242

4343
## HTML Modules (Experimental)
4444

45-
W> **This feature is experimental and partial.** Webpack 5.107 only implements the `html-loader` side of the story: importing an HTML file from JavaScript runs its tag references through the webpack pipeline. **HTML entry points** (using a `.html` file directly as `entry`, the `html-webpack-plugin` part) are **not supported yet** and are planned for the next minor release. The full story is tracked in issue [#536](https://github.com/webpack/webpack/issues/536).
45+
> [!WARNING]
46+
> **This feature is experimental and partial.** Webpack 5.107 only implements the `html-loader` side of the story: importing an HTML file from JavaScript runs its tag references through the webpack pipeline. **HTML entry points** (using a `.html` file directly as `entry`, the `html-webpack-plugin` part) are **not supported yet** and are planned for the next minor release. The full story is tracked in issue [#536](https://github.com/webpack/webpack/issues/536).
4647
4748
A real-world webpack setup that needs an HTML entry point has historically required at least two extra dependencies. The first is `html-webpack-plugin`, which generates or emits the HTML file and injects the right bundle URLs into it. The second is `html-loader`, which lets webpack walk through `<img src>`, `<link href>`, `<script src>`, and friends so those references go through the normal resolver and asset pipeline.
4849

@@ -165,7 +166,8 @@ The comment value is parsed with the same context the JS and CSS parsers use, so
165166

166167
## TypeScript Support (Experimental)
167168

168-
W> **This feature is experimental and depends on a recent Node.js.** It requires Node.js 22.6 or later for the stable `module.stripTypeScriptTypes` API. The transform handles only erasable TypeScript syntax (see limitations below). For anything else, keep using `ts-loader` or `swc-loader`.
169+
> [!WARNING]
170+
> **This feature is experimental and depends on a recent Node.js.** It requires Node.js 22.6 or later for the stable `module.stripTypeScriptTypes` API. The transform handles only erasable TypeScript syntax (see limitations below). For anything else, keep using `ts-loader` or `swc-loader`.
169171
170172
Webpack 5.107 adds first-class TypeScript support behind a new `experiments.typescript` flag. With it enabled, webpack compiles `.ts`, `.cts`, and `.mts` files directly through Node.js's built-in [`module.stripTypeScriptTypes`](https://nodejs.org/api/module.html#modulestriptypescripttypescode-options), no external loader required. The flag is also turned on automatically by [`experiments.futureDefaults`](/configuration/experiments/#experimentsfuturedefaults).
171173

@@ -460,7 +462,8 @@ const unused = createLogger('debug');
460462
realWork();
461463
```
462464

463-
W> The annotation currently only takes effect **within the module where it is declared**. Cross-module propagation is planned for a future PR.
465+
> [!WARNING]
466+
> The annotation currently only takes effect **within the module where it is declared**. Cross-module propagation is planned for a future PR.
464467
465468
## Resolver Updates
466469

pages/guides/getting-started/concepts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ You can learn more about including loaders in the [loaders section](/guides/gett
118118
While loaders transform certain types of modules, plugins can perform a much wider range of tasks, such as bundle optimization, asset management, and injecting environment variables.
119119
120120
> [!TIP]
121-
> Check out the [plugin interface](#TODO[/api/plugins]) and how to use it to extend webpack's capabilities.
121+
> Check out the [plugin interface](/docs/api/plugins/types#interface-webpackplugininstance) and how to use it to extend webpack's capabilities.
122122
123123
To use a plugin, you `import` it and add it to the `plugins` array. Most plugins are customizable through options. Since you can use a plugin multiple times in a configuration for different purposes, you create an instance of it by calling it with the `new` operator.
124124

pages/guides/getting-started/concepts/modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Beyond these, webpack supports modules written in many other languages and prepr
4242

4343
And many more. In short, webpack offers a powerful, rich API for customization that lets you use it with **any stack** while remaining **non-opinionated** about your development, testing, and production workflows.
4444

45-
For a complete list, see [the list of loaders](/docs/loaders) or learn how to [write your own](#TODO[/api/loaders]).
45+
For a complete list, see [the list of loaders](/docs/loaders) or learn how to [write your own](/docs/api/loaders/types).
4646

4747
## Further reading
4848

pages/guides/getting-started/concepts/under-the-hood.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ A non-initial chunk for `./app.jsx` is created because that module is imported d
9090
- `/dist/main.js` — an `initial` chunk
9191
- `/dist/394.js` — a `non-initial` chunk
9292

93-
By default, `non-initial` chunks have no name, so a unique ID is used instead. When using a dynamic import, you can specify a chunk name explicitly with a ["magic" comment](#TODO[/api/module-methods/#magic-comments]):
93+
By default, `non-initial` chunks have no name, so a unique ID is used instead. When using a dynamic import, you can specify a chunk name explicitly with a ["magic" comment](/guides/optimization/code-splitting/#magic-comments):
9494

9595
```jsx
9696
import(

pages/guides/getting-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,4 +390,4 @@ webpack-demo
390390
> [!WARNING]
391391
> Do not compile untrusted code with webpack. It could lead to execution of malicious code on your computer, on remote servers, or in the web browsers of your application's end users.
392392
393-
If you want to learn more about webpack's design, you can check out the [basic concepts](/guides/getting-started/concepts) and [configuration](#TODO[/configuration]) pages. Furthermore, the [API](#TODO[/api]) section digs into the various interfaces webpack offers.
393+
If you want to learn more about webpack's design, you can check out the [basic concepts](/guides/getting-started/concepts) and [configuration](#TODO[/configuration]) pages. Furthermore, the [API](/docs/api/types) section digs into the various interfaces webpack offers.

pages/guides/migration/to-v3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ require.ensure([], require => {
429429
});
430430
```
431431

432-
The ES2015 loader spec defines [`import()`](#TODO[/api/module-methods/#import-1]) as the way to load ES2015 modules dynamically at runtime. webpack treats `import()` as a split point and places the requested module in a separate chunk. `import()` takes the module name as its argument and returns a Promise.
432+
The ES2015 loader spec defines [`import()`](/guides/optimization/code-splitting/#dynamic-imports) as the way to load ES2015 modules dynamically at runtime. webpack treats `import()` as a split point and places the requested module in a separate chunk. `import()` takes the module name as its argument and returns a Promise.
433433

434434
```js
435435
function onClick() {

pages/guides/optimization/code-splitting/index.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ webpack 5.x.x compiled successfully in 268 ms
328328
> );
329329
> ```
330330
>
331-
> This helps webpack tree shake the other unused exports. See [Magic Comments](#TODO[/api/module-methods/#magic-comments]) for details.
331+
> This helps webpack tree shake the other unused exports. See [Magic Comments](#magic-comments) for details.
332332
333333
Because `import()` returns a promise, it can be used with [`async` functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). Here's how that simplifies the code:
334334
@@ -357,7 +357,7 @@ Because `import()` returns a promise, it can be used with [`async` functions](ht
357357
```
358358
359359
> [!TIP]
360-
> You can also provide a [dynamic expression](#TODO[/api/module-methods/#dynamic-expressions-in-import]) to `import()` when you need to import a specific module based on a value computed later.
360+
> You can also provide a [dynamic expression](/guides/modules-and-dependencies/dependency-management/#dynamic-expressions-in-import-or-require) to `import()` when you need to import a specific module based on a value computed later.
361361
362362
### Understanding ChunkLoadError
363363
@@ -373,6 +373,42 @@ If you encounter this error:
373373
374374
For more context, see the related discussion in the webpack issue tracker.
375375
376+
## Magic Comments
377+
378+
webpack lets you attach inline comments to a dynamic `import()` to control how the resulting chunk is named, split, and loaded. These "magic comments" go inside the `import()` call, immediately before the module request:
379+
380+
```js
381+
import(/* webpackChunkName: "my-chunk" */ './module');
382+
```
383+
384+
You can combine several in a single `import()`:
385+
386+
```js
387+
import(
388+
/* webpackChunkName: "my-chunk" */
389+
/* webpackMode: "lazy" */
390+
'./module'
391+
);
392+
```
393+
394+
The following comments are supported:
395+
396+
- **`webpackChunkName`** - a string that names the generated chunk, so it appears as, for example, `my-chunk.js` instead of a numeric id. Imports that share the same name are bundled into the same chunk.
397+
- **`webpackMode`** - controls how the module is resolved and split. One of:
398+
- `"lazy"` (default) - generates a separate lazy-loadable chunk for the module.
399+
- `"lazy-once"` - generates a single lazy-loadable chunk shared by every module matched by a [dynamic expression](/guides/modules-and-dependencies/dependency-management/#dynamic-expressions-in-import-or-require).
400+
- `"eager"` - no separate chunk is generated; the module is bundled into the current chunk and no extra network request is made. `import()` still returns a `Promise`, but it resolves immediately.
401+
- `"weak"` - the module is used only if it has already been loaded some other way; otherwise the returned `Promise` rejects.
402+
- **`webpackPrefetch`** - `true` or a number. Marks the chunk as a prefetch resource. See [Prefetching/Preloading modules](#prefetchingpreloading-modules) below.
403+
- **`webpackPreload`** - `true` or a number. Marks the chunk as a preload resource. See [Prefetching/Preloading modules](#prefetchingpreloading-modules) below.
404+
- **`webpackFetchPriority`** - `"high"`, `"low"`, or `"auto"`. Sets the fetch priority hint used when loading the chunk.
405+
- **`webpackExports`** - a string or an array of strings. Tells webpack to only bundle the named exports of the imported module, which helps it tree shake the rest.
406+
- **`webpackInclude`** / **`webpackExclude`** - a regular expression that limits which modules are bundled when you pass a [dynamic expression](/guides/modules-and-dependencies/dependency-management/#dynamic-expressions-in-import-or-require) to `import()`. `webpackInclude` bundles only matching modules; `webpackExclude` skips matching ones.
407+
- **`webpackIgnore`** - set to `true` to disable webpack's processing for this `import()`. webpack leaves the statement untouched, so it stays a native dynamic import at runtime and is never bundled or split.
408+
409+
> [!NOTE]
410+
> `require.context` and `import.meta.webpackContext` accept a similar set of options (such as `mode`), but as properties of an options object rather than as inline comments. See [Dependency Management](/guides/modules-and-dependencies/dependency-management) for details.
411+
376412
## Prefetching/Preloading modules
377413
378414
webpack 4.6.0+ adds support for prefetching and preloading.

0 commit comments

Comments
 (0)