You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
517 B

const modulesConstant = import.meta.glob("../constant/**/*.js", {
import: "default",
eager: true,
});
const constantArr = [];
const $globalConstant = {};
for (const [key, value] of Object.entries(modulesConstant)) {
for (const [childKey, childValue] of Object.entries(value)) {
if (constantArr.includes(childValue)) {
console.error(`文件${key}中常量${childValue}存在重复`);
} else {
constantArr.push(childValue);
$globalConstant[childKey] = childValue;
}
}
}
export { $globalConstant };