diff --git a/docs/faq/README.md b/docs/faq/README.md index 2afe378..0d87a45 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -140,6 +140,18 @@ How to determine the completion of the container DOM loading? The vue app can be If it still reports an error, check whether the container DOM is placed on a routing page of the main app, please refer to [How to load micro apps on a routing page of the main app](#How to load micro apps on a routing page of the main app) +## `[import-html-entry]: error occurs while excuting xxx script http://xxx.xxx.xxx/x.js` +![](https://user-images.githubusercontent.com/22413530/109919189-41563d00-7cf3-11eb-8328-711228389d63.png) +The first line is just an auxiliary information printed by qiankun through console.error, which is used to help users quickly know which js has an error, not a real exception. The real exception information is on the second line. + +For example, such an error indicates that when qiankun was executing the http://localhost:9100/index.bundle.js of the sub application, this js itself threw an exception. The specific exception information is Uncaught TypeError: Cannot read property 'call' of undefined. + +Sub-application exceptions can be attempted to be resolved through the following steps: + +Check the error js for syntax errors according to the specific exception information, such as missing semicolons, dependence on uninitialized variables, etc. +Whether it depends on global variables provided by the main application, but the main application is not actually initialized. +Compatibility issues. The js itself of the sub-application has syntax compatibility issues in the current runtime environment. + ## How to load micro apps on a routing page of the main app It must be ensured that the routing page of the main app is also loaded when the micro app is loaded. diff --git a/docs/faq/README.zh.md b/docs/faq/README.zh.md index 5d0f98f..ec1e666 100644 --- a/docs/faq/README.zh.md +++ b/docs/faq/README.zh.md @@ -141,6 +141,17 @@ qiankun 抛出这个错误是因为微应用加载后容器 DOM 节点不存在 如果仍然报错,检查容器 DOM 是否放在了主应用的某个路由页面,请参考[如何在主应用的某个路由页面加载微应用](#如何在主应用的某个路由页面加载微应用)。 +## `[import-html-entry]: error occurs while excuting xxx script http://xxx.xxx.xxx/x.js` +![](https://user-images.githubusercontent.com/22413530/109919189-41563d00-7cf3-11eb-8328-711228389d63.png) +其中第一行只是 qiankun 通过 `console.error` 打印出来的一个辅助信息,目的是帮助用户更快的知道是哪个 js 报错了,并不是真的异常。真正的异常信息在第二行。 + +比如上图这样一个报错,指的是 qiankun 在执行子应用的 `http://localhost:9100/index.bundle.js` 时,这个 js 本身抛异常了。而具体的异常信息就是 `Uncaught TypeError: Cannot read property 'call' of undefined`. + +子应用本身的异常,可以尝试通过以下步骤排查解决: +1. 根据具体的异常信息,检查报错的 js 是否有语法错误,比如少了分号、依赖了未初始化的变量等。 +2. 是否依赖了主应用提供的全局变量,但实际主应用并未初始化。 +3. 兼容性问题。子应用这个 js 本身在当前运行环境存在语法兼容性问题。 + ## 如何在主应用的某个路由页面加载微应用 必须保证微应用加载时主应用这个路由页面也加载了。