/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/template-loader-fallback/template-loader.js
13 строк
590 B
Alexander Akait
fix: keep loader results as JavaScript when css/html support is implicitly enabled (#21485)
23 июл 2026, 14:22
Не верифицирован
23 июл 2026, 14:22
27dfadb
Код
Авторство
О чём код?
"use strict"; // Minimal stand-in for html-webpack-plugin's lodash template loader: turns the // HTML source into a JS module exporting a template function. The source is // embedded only as a JSON data literal (never into the constructed function // body), so this stays an executable JS module without tripping code scanners. /** @type {import("../../../../").LoaderDefinition} */ module.exports = function (source) { return [ `var template = ${JSON.stringify(source)};`, 'module.exports = function (params) { return template.replace("{title}", params.title); };' ].join("\n"); };