/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/css/css-server-styles/index.js
16 строк
510 B
Alexander Akait
feat(css): add __webpack_css_server_styles__ to read server-collected CSS (#21576)
01 авг 2026, 22:03
Не верифицирован
01 авг 2026, 22:03
d3e5a0b
Код
Авторство
О чём код?
import "./style.css"; const hasDocument = typeof document !== "undefined"; it("exposes the collected styles as a string", () => { expect(typeof __webpack_css_server_styles__).toBe("string"); }); it("returns the styles collected while rendering without a DOM", () => { if (hasDocument) { // styles went into the document, so nothing was collected for the server expect(__webpack_css_server_styles__).toBe(""); } else { expect(__webpack_css_server_styles__).toContain("color: rebeccapurple"); } });