更新扩展加载机制
This commit is contained in:
parent
5191a10fa7
commit
92b12d5363
@ -41,7 +41,30 @@ function loadScript(url: string): Promise<void> {
|
||||
})
|
||||
}
|
||||
|
||||
const extensionGlob = import.meta.glob('@apps/*/frontend/src/shared/extensions/*.ts')
|
||||
const localExtensionGlob = import.meta.glob('/src/shared/extensions/*.ts')
|
||||
|
||||
let extensionsLoaded = false
|
||||
|
||||
async function loadExtensionModules(): Promise<void> {
|
||||
if (extensionsLoaded) return
|
||||
extensionsLoaded = true
|
||||
|
||||
const allExtensions = { ...extensionGlob, ...localExtensionGlob }
|
||||
for (const [path, loader] of Object.entries(allExtensions)) {
|
||||
try {
|
||||
await loader()
|
||||
} catch (err) {
|
||||
console.error(`[Extensions] Failed to load extension from ${path}:`, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadAppExtensions(): Promise<void> {
|
||||
// Load TS extension modules from all apps
|
||||
await loadExtensionModules()
|
||||
|
||||
// Load legacy JS extensions via script tags
|
||||
const urls: string[] = win.jingrow?.boot?.vue_app_extensions || []
|
||||
if (!urls.length) return
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user