mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-30 18:00:56 +01:00
resolved import async components issue with vue3-sfc-loader
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
const vue = window['Vue'];
|
||||
import * as vue from '@vue/runtime-dom';
|
||||
const {loadModule: sfcLoadModule} = window['vue3-sfc-loader'];
|
||||
|
||||
export const getLoadModuleOptions = () => {
|
||||
export const getLoadModuleOptions = (): any => {
|
||||
return {
|
||||
moduleCache: {
|
||||
vue,
|
||||
},
|
||||
pathResolve({ refPath, relPath }: {refPath?: string; relPath?: string}) {
|
||||
pathResolve({refPath, relPath}: { refPath?: string; relPath?: string }) {
|
||||
// self
|
||||
if ( relPath === '.' ) {
|
||||
if (relPath === '.') {
|
||||
return refPath;
|
||||
}
|
||||
|
||||
// relPath is a module name ?
|
||||
if ( relPath?.[0] !== '.' && relPath?.[0] !== '/' ) {
|
||||
if (relPath?.toString()?.[0] !== '.' && relPath?.toString()?.[0] !== '/') {
|
||||
return relPath;
|
||||
}
|
||||
|
||||
return String(new URL(relPath, refPath === undefined ? window.location.toString() : refPath));
|
||||
return String(new URL(relPath.toString(), refPath === undefined ? window.location.toString() : refPath.toString()));
|
||||
},
|
||||
async getFile(url: string) {
|
||||
const res = await fetch(url);
|
||||
const res = await fetch(url.toString());
|
||||
if (!res.ok) {
|
||||
throw Object.assign(new Error(res.statusText + ' ' + url), {res});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user