/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/script-src-sibling-attrs/webpack.config.js
47 строк
1 KB
Alexander Akait
perf: speed up CSS and HTML parsing and code generation (#21181)
13 июн 2026, 14:19
Не верифицирован
13 июн 2026, 14:19
b83041a
Код
Авторство
О чём код?
"use strict"; // A `<script src>` HTML entry whose JS imports CSS, carrying the three // copyable CSP/fetch attributes in all three source forms — quoted // (`nonce="…"`), bare (`crossorigin`), and unquoted (`referrerpolicy=…`). // The synthesized sibling `<link>` must carry each one back byte-exact, // exercising every branch of the parser's `attrSourceSpan`. const fs = require("fs"); const path = require("path"); const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", entry: { page: "./page.html" }, output: { filename: "[name].js", chunkFilename: "[name].chunk.js" }, optimization: { chunkIds: "named" }, experiments: { html: true, css: true }, plugins: [ { apply(compiler) { compiler.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.processAssets.tap( { name: "copy-test", stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL }, () => { const data = fs.readFileSync(path.resolve(__dirname, "test.js")); compilation.emitAsset( "test.js", new webpack.sources.RawSource(data) ); } ); }); } } ] };