/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/resource-hints-function/test.js
15 строк
675 B
Alexander Akait
feat(html): add output.html.resourceHints and output.environment.modulePreload (#21408)
14 июл 2026, 01:31
Не верифицирован
14 июл 2026, 01:31
f477930
Код
Авторство
О чём код?
const fs = require("fs"); const path = require("path"); const page = fs.readFileSync(path.resolve(__dirname, "page.html"), "utf-8"); const head = page.slice(0, page.indexOf("</head>")); it("should evaluate a resourceHints function with the page context", () => { // The function keyed off `entryName` ("page") and read `defaultHints`. expect(head).toContain('<link rel="preload" as="image" href="/hero-page.jpg">'); expect(head).toContain('<link rel="prefetch" as="script" href="settings.js">'); }); it("should still emit the auto initial-graph preload alongside custom hints", () => { expect(head).toContain('<link rel="preload" as="script" href="runtime.js">'); });