/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/css/link-insert-hook/webpack.config.js
38 строк
802 B
Alexander Akait
feat: add linkInsert hook to CssLoadingRuntimeModule (#20947)
12 май 2026, 16:39
Не верифицирован
12 май 2026, 16:39
0053c9f
Код
Авторство
О чём код?
"use strict"; const webpack = require("../../../../"); /** @type {import("../../../../").Configuration} */ module.exports = { target: "web", output: { chunkFilename: "[name].chunk.js" }, optimization: { chunkIds: "named" }, plugins: [ (compiler) => { compiler.hooks.thisCompilation.tap( "LinkInsertHookTest", (compilation) => { const hooks = webpack.web.CssLoadingRuntimeModule.getCompilationHooks( compilation ); // Override insertion: place link into <body> instead of // the default `document.head.appendChild(link);`. hooks.linkInsert.tap( "LinkInsertHookTest", () => 'link.setAttribute("data-link-insert", "custom"); document.body.appendChild(link);' ); } ); } ], experiments: { css: true } };