Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: defer scripts should wait until html loaded #2816

Merged
merged 7 commits into from
Nov 17, 2023
Merged

Conversation

kuitos
Copy link
Member

@kuitos kuitos commented Nov 16, 2023

Copy link

changeset-bot bot commented Nov 16, 2023

🦋 Changeset detected

Latest commit: ede130c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@qiankunjs/loader Patch
@qiankunjs/sandbox Patch
@qiankunjs/shared Patch
qiankun Patch
@qiankunjs/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
qiankun ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 17, 2023 10:38am

@qiYuei
Copy link
Contributor

qiYuei commented Nov 16, 2023

这块 resolve是不应该放入事件监听的回调 listener 更加合理点? resolve后执行 .then 说明 script 代码一定是执行完了

scriptTranspiledDeferred?.resolve();

@qiYuei
Copy link
Contributor

qiYuei commented Nov 16, 2023

这块 resolve是不应该放入事件监听的回调 listener 更加合理点? resolve后执行 .then 说明 script 代码一定是执行完了

scriptTranspiledDeferred?.resolve();

用这个分支代码测试后发现还是有几率报错,错误跟原先一样没找到导出的 变量,改成这样后加载就不会报错了。

@kuitos
Copy link
Member Author

kuitos commented Nov 17, 2023

这没道理,我用 examples 测也是正常的。我再用 vue 的版本测试看看

@kuitos
Copy link
Member Author

kuitos commented Nov 17, 2023

@qiYuei 拉下新代码再看看

@qiYuei
Copy link
Contributor

qiYuei commented Nov 17, 2023

可以了 👍

@kuitos kuitos merged commit bd12dba into next Nov 17, 2023
6 checks passed
@kuitos kuitos deleted the fix/defer-order branch November 17, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants