You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8" /><linkrel="icon" href="%PUBLIC_URL%/favicon.ico" /><metaname="viewport" content="width=device-width, initial-scale=1" /><metaname="theme-color" content="#000000" /><metaname="description"
content="Web site created using create-react-app"
/><linkrel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /><!-- manifest.json provides metadata used when your web app is installed on a user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ --><linkrel="manifest" href="%PUBLIC_URL%/manifest.json" /><script>var__JS_RETRY__={};function__rpReport(data){console.log('__rpReport');}function__rpJsReport(loadType,msidType,url){console.log('__rpJsReport');}function__retryPlugin(event){console.log('retryPlugin')}// 改成下面就可以了// window.__JS_RETRY__ = {};//// window.__rpReport = (data) => {// console.log('__rpReport');// }//// window.__rpJsReport = (loadType, msidType, url) => {// console.log('__rpJsReport');// }//// window.__retryPlugin = (event) => {// console.log('retryPlugin')// }</script><title>React App</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><divid="root"></div><script>if(!__JS_RETRY__["main.bbb7b1ce.chunk.js"]){console.log('no retry');}else{console.log('retry');}</script></body></html>
子应用中 script 标签使用全局变量,会报错:XXXX is undefined
What happens?
主应用引用子应用时,子应用的 script 标签中写了全局变量会报错:
最小可复现仓库
https://github.com/haixiangyan/qiankun-bigass-app/tree/broken
main 为主应用,taobao 为有问题的子应用,上述代码写在 public/index.html 中。
复现步骤,错误日志以及相关配置
报错内容:
以及
我自己试了一下,直接显式挂载到
window
上是 OK 的,比如window.x = 11
,但是目前我们自己的脚手架会自动生成如var x = 1
以及function x() {}
这样的隐式挂载的代码,所以希望可以大佬们对于这样的情况有什么建议么?相关环境信息
The text was updated successfully, but these errors were encountered: