/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/stylesheet-entry-runtime-chunk/webpack.config.js
54 строки
1 KB
Alexander Akait
Experimental HTML: parser/generator options, compilation hooks, and fixes (#21441)
19 июл 2026, 23:58
Не верифицирован
19 июл 2026, 23:58
cb904da
Код
Авторство
О чём код?
"use strict"; // Regression test: a `<link rel="stylesheet">` HTML entry together with // `optimization.runtimeChunk` puts a JS-only runtime chunk in the stylesheet // entrypoint. The stylesheet sibling loop must skip chunks without a `.css` // asset — otherwise it emits `<link rel="stylesheet" href="runtime.css">` // pointing at a file that is never emitted (a 404). 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", runtimeChunk: "single" }, 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 }, () => { compilation.emitAsset( "test.js", new webpack.sources.RawSource( fs.readFileSync(path.resolve(__dirname, "test.js")) ) ); } ); }); } } ] };