/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/css/createStylesheet-attributes/webpack.config.js
45 строк
1 KB
Alexander Akait
test: add missing CSS test cases inspired by css-loader and mini-css-extract-plugin (#20914)
05 май 2026, 20:57
Не верифицирован
05 май 2026, 20:57
959e210
Код
Авторство
О чём код?
"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( "CreateStylesheetAttributesTest", (compilation) => { const hooks = webpack.web.CssLoadingRuntimeModule.getCompilationHooks( compilation ); // Mirrors mini-css-extract-plugin's `attributes` plugin option: // merge a static map of attributes onto every stylesheet link. // Mirrors mini-css-extract-plugin's `linkType` plugin option: // pin link.type explicitly (defaulting to text/css). hooks.createStylesheet.tap( "CreateStylesheetAttributesTest", (source) => [ source, 'link.setAttribute("id", "main-styles");', 'link.setAttribute("data-theme", "dark");', 'link.type = "text/css";' ].join("\n") ); } ); } ], experiments: { css: true } };