/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/plugins/environment-plugin/errors.js
62 строки
1 KB
Alexander Akait
chore: resolve "use strict" TODO (#19705)
16 июл 2025, 17:29
Не верифицирован
16 июл 2025, 17:29
d8690f3
Код
Авторство
О чём код?
"use strict"; const variables = [ "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii" ]; const modules = [ { name: "aaa", variables: ["aaa"] }, { name: "bbbccc", variables: ["bbb", "ccc"] }, { name: "ddd", variables: [], allowedErrors: [ [{ compilerPath: /ddd/ }, /DDD environment variable is undefined./] ] }, { name: "eeefff", variables: ["eee", "fff"] }, { name: "ggghhh", variables: ["ggg", "hhh"] }, { name: "iii", variables: ["iii"] } ]; // build an array of regular expressions of expected errors const regex = []; for (const module of modules) { for (const variable of variables) { if (!module.variables.includes(variable)) { // the module doesn't include the env variable, an error is expected when requiring the variable regex.push([ { compilerPath: new RegExp(`${module.name}`) }, new RegExp(`Can't resolve '${variable}'`) ]); } } if (module.allowedErrors) { regex.push(...module.allowedErrors); } } module.exports = regex;