note: no summary for this digest release
Digest releases are listed without a summary. The original release notes for this version are below.
release-notesgithub.com/webpack/webpack · 29 lines
- ### Patch Changes
- - Align the experimental HTML tokenizer with the WHATWG spec: fix offset-range bugs in the script-data, content-mode end-tag, attribute-value, and EOF states; surface tokenizer parse errors to consumers via a new `parseError` callback (`"warning"` when the tokenizer recovers and the emitted token is still well-formed, `"error"` when the offset range is incomplete — e.g. `eof-in-tag`); and add the full WHATWG named character references table so `decodeHtmlEntities` handles all named entities (including legacy bare forms like `&` and multi-code-point entities like `≂̸`) with proper longest-prefix backtracking. (by [@alexander-akait](https://github.com/alexander-akait) in [#21000](https://github.com/webpack/webpack/pull/21000))
- - Tree-shake CommonJS modules imported through a `const NAME = require(LITERAL)` binding when only static members of `NAME` are read. Previously webpack treated every export of such modules as referenced (because the bare `require()` dependency reports `EXPORTS_OBJECT_REFERENCED`), so unused `exports.x = ...` assignments remained in the bundle even with `usedExports` enabled. The parser now forwards `NAME.x` / `NAME.x()` / `NAME["x"]` accesses to the underlying `CommonJsRequireDependency` as referenced exports, falling back to the full exports object the moment `NAME` is read in any other context (passed by value, destructured later, accessed with a dynamic key, …). This brings the binding form to parity with the existing destructuring form (`const { x } = require(...)`). (by [@alexander-akait](https://github.com/alexander-akait) in [#21003](https://github.com/webpack/webpack/pull/21003))
- - Fix `RangeError: Maximum call stack size exceeded` thrown from `HarmonyImportSideEffectDependency.getModuleEvaluationSideEffectsState` on long linear chains of side-effect-free imports. `NormalModule.getSideEffectsConnectionState` previously descended through `HarmonyImportSideEffectDependency.getModuleEvaluationSideEffectsState` recursively, adding two stack frames per module, which overflowed V8's stack at a few thousand modules deep. The traversal is now iterative. (by [@alexander-akait](https://github.com/alexander-akait) in [#20993](https://github.com/webpack/webpack/pull/20993))
- - Fix `NormalModuleFactory` parser/generator types: (by [@alexander-akait](https://github.com/alexander-akait) in [#20999](https://github.com/webpack/webpack/pull/20999))
- - `module.generator.html` now uses `HtmlGeneratorOptions` instead of `EmptyGeneratorOptions` (the `extract` option was hidden from the `createGenerator` / `generator` hook types).
- - WebAssembly (`webassembly/async`, `webassembly/sync`) generator hooks now use `EmptyGeneratorOptions` instead of `EmptyParserOptions`.
- - `NormalModuleFactory#getParser` / `createParser` / `getGenerator` / `createGenerator` are now generic over the module-type string, returning the specific parser/generator class for known types (e.g. `JavascriptParser` for `"javascript/auto"`, `CssGenerator` for `"css"`, etc.) instead of always returning the base `Parser` / `Generator`.
- - `NormalModuleCreateData` is now generic over the module type so `parser`, `parserOptions`, `generator`, and `generatorOptions` are narrowed to the specific class / options for the given `type`.
- - Link import bindings used inside `define(...)` callbacks in ES modules. Previously, `HarmonyDetectionParserPlugin` skipped walking the arguments of `define` calls in harmony modules, so references to imported bindings inside an inline AMD `define` factory (e.g. `define(function () { console.log(foo); })`) were not rewritten to their imported references and could cause `ReferenceError` at runtime. Inner graph usage analysis is also fixed for the related pattern `const fn = function () { foo; }; define(fn);`. (by [@alexander-akait](https://github.com/alexander-akait) in [#20990](https://github.com/webpack/webpack/pull/20990))
- - HTML-entry pipeline (`experiments.html` + `experiments.css`): emit `<link rel="stylesheet">` tags for CSS chunks reachable from a `<script src>` entry. Previously when the bundled JS imported CSS, the resulting `.css` file was emitted to disk but never referenced from the extracted HTML (no `<link>` tag), and when `splitChunks` extracted CSS into sibling chunks the HTML cloned the originating `<script>` for each one — producing `<script src="style.js">` pointing at non-existent JS filenames instead of `<link rel="stylesheet" href="style.css">`. CSS chunks are now sorted by the entrypoint's module post-order index so the `<link>` tags also appear in source import order, fixing the cascade ordering issue documented in `html-webpack-plugin#1838` and `webpack/mini-css-extract-plugin#959` for HTML-entry builds. `nonce`/`crossorigin`/`referrerpolicy` are copied from the originating tag onto the emitted `<link>`. (by [@alexander-akait](https://github.com/alexander-akait) in [#21002](https://github.com/webpack/webpack/pull/21002))
- - Allow `devtool` and `SourceMapDevToolPlugin` (or multiple `SourceMapDevToolPlugin` instances) to coexist on the same asset. Previously the second instance would silently skip any asset whose `info.related.sourceMap` had already been set by an earlier instance, and even when it ran the asset had been rewrapped as a `RawSource` so no source map could be recovered — producing an empty `.map` file. The plugin now keeps a per-compilation stash of pristine source maps, namespaces its persistent cache entries by the options that affect output, and appends additional `related.sourceMap` entries instead of overwriting them. The classic workaround of pairing `devtool: 'hidden-source-map'` with a `new webpack.SourceMapDevToolPlugin({ filename: '[file].secondary.map', noSources: true })` now produces both maps in a single build. (by [@alexander-akait](https://github.com/alexander-akait) in [#21001](https://github.com/webpack/webpack/pull/21001))
- - Narrow `TemplatePathFn` callback types by context. `pathData.chunk` is now non-optional for chunk filename callbacks (`output.filename`, `chunkFilename`, `cssFilename`, `cssChunkFilename`, `htmlFilename`, `htmlChunkFilename`, `optimization.splitChunks.cacheGroups[*].filename`), and `pathData.module` is non-optional for module filename callbacks (`output.assetModuleFilename`, per-module `generator.filename` / `generator.outputPath`, `module.parser.css.localIdentName`). (by [@alexander-akait](https://github.com/alexander-akait) in [#20987](https://github.com/webpack/webpack/pull/20987))
- - Tighten the `CreateData` typedef in `NormalModuleFactory`. `CreateData` now represents the fully-populated value passed to the `createModule`, `module`, and `createModuleClass` hooks (`NormalModuleCreateData & { settings: ModuleSettings }`), while `ResolveData.createData` is typed as `Partial<CreateData>` to reflect the empty initial state. Plugins tapping those hooks no longer need to cast individual fields away from optional. (by [@alexander-akait](https://github.com/alexander-akait) in [#20992](https://github.com/webpack/webpack/pull/20992))
- - Stop `webpackPrefetch` / `webpackPreload` magic comments from leaking across `import()` call sites that share a `webpackChunkName`. When two imports targeted the same named chunk and only one of them set `webpackPrefetch: true`, the prefetch directive was applied from every parent chunk that referenced the named chunk. Prefetch and preload orders are now resolved per `import()` call site instead of from the shared chunk group's accumulated options. (by [@alexander-akait](https://github.com/alexander-akait) in [#20994](https://github.com/webpack/webpack/pull/20994))
- - Fix `[fullhash:N]` and `[hash:N]` (with length suffix) in `output.publicPath` not being interpolated at runtime. The detection regex in `RuntimePlugin` only matched `[fullhash]` / `[hash]` without a length suffix, so the `PublicPathRuntimeModule` was not flagged as a full-hash module and `__webpack_require__.p` was emitted with the placeholder `XXXX` left in place (e.g. `out/XXXX/`) instead of the real hash truncated to the requested length. (by [@alexander-akait](https://github.com/alexander-akait) in [#21004](https://github.com/webpack/webpack/pull/21004))
- - Re-export `ModuleNotFoundError` from `webpack/lib/ModuleNotFoundError` for backward compatibility with old plugins that import it from that path. This re-export will be removed in webpack 6. (by [@alexander-akait](https://github.com/alexander-akait) in [#20988](https://github.com/webpack/webpack/pull/20988))