/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/plugins/add-lazy-runtime-module/webpack.config.js
28 строк
694 B
Alexander Akait
perf: load webpack's own modules only when a build needs them (#21652)
10 авг 2026, 07:32
Не верифицирован
10 авг 2026, 07:32
8e28763
Код
Авторство
О чём код?
"use strict"; const RuntimeGlobals = require("../../../../lib/RuntimeGlobals"); const PLUGIN_NAME = "AddLazyRuntimeModuleTestPlugin"; /** @type {import("../../../../types").Configuration} */ module.exports = { plugins: [ { apply(compiler) { compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { compilation.hooks.additionalTreeRuntimeRequirements.tap( PLUGIN_NAME, (chunk, set) => { set.add(RuntimeGlobals.global); compilation.addLazyRuntimeModule( chunk, () => Promise.resolve(require("./MarkerRuntimeModule")), (MarkerRuntimeModule) => new MarkerRuntimeModule() ); } ); }); } } ] };