/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/hotCases/html/html-inline-script-and-style/index.js
25 строк
1 KB
Alexander Akait
feat: HMR for HTML modules with DOM patching for extracted pages (#21011)
27 май 2026, 15:35
Не верифицирован
27 май 2026, 15:35
04be1fe
Код
Авторство
О чём код?
import html from "./page.html"; it("should hot-update an HTML module that contains both inline <style> and inline <script>", (done) => { // Inline `<style>` bodies are routed through the CSS pipeline and the // processed CSS is inlined back into the rewritten HTML (exportType // "text"), so it appears verbatim. Inline `<script>` bodies are // bundled as their own data-URI entries — the rewritten HTML only // references them via `<script src=…>`, so the script body itself // does NOT appear in the exported string. expect(html).toContain("<title>combined v1</title>"); expect(html).toContain("color: red"); expect(html).not.toContain('window.__page_value__ = "v1"'); expect(html).toMatch(/<script src="[^"]+\.js"/); NEXT( require("../../update")(done, true, () => { const updated = require("./page.html"); expect(updated).toContain("<title>combined v2</title>"); expect(updated).toContain("color: blue"); expect(updated).not.toContain("color: red"); expect(updated).not.toContain("v1</title>"); done(); }) ); });