diff --git a/docs/api/preloadApp.md b/docs/api/preloadApp.md index 1800e1a40..56bf77b0d 100644 --- a/docs/api/preloadApp.md +++ b/docs/api/preloadApp.md @@ -177,6 +177,8 @@ interface ScriptObjectLoader { src?: string; /** 脚本是否为module模块 */ module?: boolean; + /** 脚本是否为async执行 */ + async?: boolean; /** 脚本是否设置crossorigin */ crossorigin?: boolean; /** 脚本crossorigin的类型 */ diff --git a/docs/api/startApp.md b/docs/api/startApp.md index eaea4e800..a9ecdb426 100644 --- a/docs/api/startApp.md +++ b/docs/api/startApp.md @@ -206,6 +206,8 @@ interface ScriptObjectLoader { src?: string; /** 脚本是否为module模块 */ module?: boolean; + /** 脚本是否为async执行 */ + async?: boolean; /** 脚本是否设置crossorigin */ crossorigin?: boolean; /** 脚本crossorigin的类型 */ diff --git a/packages/wujie-core/src/iframe.ts b/packages/wujie-core/src/iframe.ts index d698a1d70..9e9a68ba4 100644 --- a/packages/wujie-core/src/iframe.ts +++ b/packages/wujie-core/src/iframe.ts @@ -650,7 +650,7 @@ export function syncIframeUrlToWindow(iframeWindow: Window): void { * @param iframeWindow */ export function insertScriptToIframe(scriptResult: ScriptObject | ScriptObjectLoader, iframeWindow: Window) { - const { src, module, content, crossorigin, crossoriginType, callback } = scriptResult as ScriptObjectLoader; + const { src, module, content, crossorigin, crossoriginType, async, callback } = scriptResult as ScriptObjectLoader; const scriptElement = iframeWindow.document.createElement("script"); const nextScriptElement = iframeWindow.document.createElement("script"); const { replace, plugins, proxyLocation } = iframeWindow.__WUJIE; @@ -686,14 +686,15 @@ export function insertScriptToIframe(scriptResult: ScriptObject | ScriptObjectLo if (/^