Skip to content

Commit 485c3a9

Browse files
committed
fix: add debug logs for the sidbar icon
1 parent 972e54b commit 485c3a9

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

adminforth/spa/src/utils.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,25 @@ export const loadFile = (file: string) => {
8888
}
8989
let path;
9090
let baseUrl = '';
91-
console.log('loadFile', file, "import.meta.url", import.meta.url);
9291
if (file.startsWith('@/')) {
93-
console.log('loading from @/');
9492
path = file.replace('@/', '');
9593
console.log('path', path);
96-
baseUrl = new URL(`./${path}`, new URL(import.meta.url).origin + new URL(import.meta.url).pathname).href;
94+
const modules = import.meta.glob('./**/*');
95+
const fileModulePath = `./${path}`;
96+
let matchingModulePath = '';
97+
for (const modulePath in modules) {
98+
console.log('modulePath', modulePath);
99+
if (modulePath === fileModulePath) {
100+
matchingModulePath = modulePath;
101+
break;
102+
}
103+
}
104+
console.log('matchingModulePath', matchingModulePath);
105+
106+
107+
108+
109+
baseUrl = new URL(fileModulePath ,import.meta.url).href;
97110
console.log('baseUrl', baseUrl);
98111
} else if (file.startsWith('@@/')) {
99112
path = file.replace('@@/', '');

0 commit comments

Comments
 (0)