diff --git a/docs/faq/README.md b/docs/faq/README.md index 38a9f63..f73d822 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -477,6 +477,71 @@ Since qiankun get assets which imported by sub app via fetch, these static resou See [Enable Nginx Cors](https://enable-cors.org/server_nginx.html). +## How to solve that micro apps loaded failed due to abnormal scripts inserted dynamically by carriers + +Scripts inserted by carriers are usually marked with `async` to avoid loading of block micro apps. This is usually no problem, such as: + +```html + +``` + +However, if some inserted scripts are not marked as `async`, once such scripts fail to run, the entire application will be blocked and subsequent scripts will no longer be executed. We can solve this problem in the following ways: + +### Use a custom `getTemplate` method + +Filter abnormal scripts in the HTML template of the micro app through the `getTemplate` method implemented by yourself. + +```js +import { start } from 'qiankun'; + +start({ + getTemplate(tpl) { + return tpl.replace('