/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/minimize-transforms/webpack.config.js
50 строк
1 KB
Alexander Akait
feat(minify): safe HTML minify transforms, driven by the spec grammars (#21586)
02 авг 2026, 23:06
Не верифицирован
02 авг 2026, 23:06
99dd2c7
Код
Авторство
О чём код?
"use strict"; const MinimizerPlugin = require("minimizer-webpack-plugin"); const htmlMinify = require("../../../../lib/html/htmlMinify"); /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", mode: "production", output: { filename: "[name].js", pathinfo: false }, module: { generator: { html: { extract: true } }, parser: { html: { // The corpus is about serialization, so its `src` / `srcset` stay // literal instead of resolving to hashed assets. sources: false } } }, optimization: { minimize: true, // The harness replaces the default minimizer, so wire the HTML one the way // `lib/config/defaults.js` does. minimizer: [ { apply: (compiler) => { new MinimizerPlugin({ test: /\.html(\?.*)?$/i, // In-process, so the coverage instrument sees the minify run: // the worker pool is another process and reports nothing. parallel: false, minify: [htmlMinify], minimizerOptions: [{}] }).apply(/** @type {EXPECTED_ANY} */ (compiler)); } } ] }, experiments: { html: true } };