reactor:解决微信小程序的「代码质量」在「JS 文件」提示:主包内,不应该存在主包未使用的 JS 文件

This commit is contained in:
YunaiV
2025-04-29 12:07:11 +08:00
parent f646458b15
commit 5da0382a25
3 changed files with 13 additions and 10 deletions
+11
View File
@@ -0,0 +1,11 @@
// 目的:解决微信小程序的「代码质量」在「JS 文件」提示:主包内,不应该存在主包未使用的 JS 文件
const files = import.meta.glob('./*/*.js', { eager: true });
let api = {};
Object.keys(files).forEach((key) => {
api = {
...api,
[key.replace(/(.*\/)*([^.]+).*/gi, '$2')]: files[key].default,
};
});
export default api;
-10
View File
@@ -1,10 +0,0 @@
const files = import.meta.glob('./*.js', { eager: true });
let api = {};
Object.keys(files).forEach((key) => {
api = {
...api,
[key.replace(/(.*\/)*([^.]+).*/gi, '$2')]: files[key].default,
};
});
// TODO @芋艿:要不要删除
export default api;