/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v7.28.1
scripts/rollup-plugin-dependency-condition.js
13 строк
372 B
Nicolò Ribaudo
Materialize conditional dependencies when bundling (#15842)
07 авг 2023, 19:36
Не верифицирован
07 авг 2023, 19:36
8e66b93
Код
Авторство
О чём код?
export default function (value) { const re = value ? /^(.*?-BABEL_8_BREAKING)-false$/ : /^(.*?-BABEL_8_BREAKING)-true$/; return { name: "dependency-condition", resolveId(source, importer, options) { const match = source.match(re); if (!match) return null; return this.resolve(`${match[1]}-${value}`, importer, options); }, }; }