Skip to content

Commit 3d499d0

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents f41538c + d21d74f commit 3d499d0

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed
-7.49 KB
Loading

adminforth/spa/src/utils.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,20 @@ export const loadFile = (file: string) => {
8686
if (file.startsWith('http')) {
8787
return file;
8888
}
89-
console.log('Loading file:', file);
9089
let path;
9190
let baseUrl = '';
91+
console.log('loadFile', file, "import.meta.url", import.meta.url);
9292
if (file.startsWith('@/')) {
93-
console.log('Loading from @/');
93+
console.log('loading from @/');
9494
path = file.replace('@/', '');
95-
console.log('Resolved path:', path);
96-
baseUrl = new URL(`./${path}`, import.meta.url.split('?')[0]).href;
97-
console.log('Base URL:', baseUrl);
95+
console.log('path', path);
96+
baseUrl = new URL(`./${path}`, new URL(import.meta.url).origin + new URL(import.meta.url).pathname).href;
97+
console.log('baseUrl', baseUrl);
9898
} else if (file.startsWith('@@/')) {
99-
console.log('Loading from @@/');
10099
path = file.replace('@@/', '');
101-
console.log('Resolved path:', path);
102-
baseUrl = new URL(`./custom/${path}`, import.meta.url.split('?')[0]).href;
103-
console.log('Base URL:', baseUrl);
100+
baseUrl = new URL(`./${path}`, new URL(import.meta.url).origin + new URL(import.meta.url).pathname).href;
104101
} else {
105-
baseUrl = new URL(`./${file}`, import.meta.url.split('?')[0]).href;
106-
console.log('Loading from relative path:', baseUrl);
102+
baseUrl = new URL(`./${file}`, new URL(import.meta.url).origin + new URL(import.meta.url).pathname).href;
107103
}
108104
return baseUrl;
109105
}

0 commit comments

Comments
 (0)