/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/deep-scope-analysis/remove-export/webpack.config.js
45 строк
1 KB
hai-x
feat: support `optimization.inlineExports` (#20973)
27 май 2026, 18:36
Не верифицирован
27 май 2026, 18:36
1ea4f72
Код
Авторство
О чём код?
"use strict"; /** @typedef {import("../../../../").Compilation} Compilation */ /** @typedef {import("../../../../").Module} Module */ /** @type {import("../../../../").Configuration} */ module.exports = { optimization: { usedExports: true, concatenateModules: false, sideEffects: false }, plugins: [ function apply() { this.hooks.compilation.tap("Test", (compilation) => { compilation.hooks.dependencyReferencedExports.tap( "Test", (referencedExports, dep) => { const module = /** @type {Module} */ (compilation.moduleGraph.getParentModule(dep)); if (!module.identifier().endsWith("module.js")) { return referencedExports; } const refModule = compilation.moduleGraph.getModule(dep); if ( refModule && refModule.identifier().endsWith("reference.js") && referencedExports.some((ref) => { const names = Array.isArray(ref) ? ref : ref.name; return names.length === 1 && names[0] === "unused"; }) ) { return referencedExports.filter((ref) => { const names = Array.isArray(ref) ? ref : ref.name; return names.length !== 1 || names[0] !== "unused"; }); } return referencedExports; } ); }); } ] };