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: improve register check, close #876 #878

Merged
merged 1 commit into from Dec 27, 2021
Merged

Conversation

liyongning
Copy link
Contributor

微前端架构下,子应用重复注册 composition-api 插件失败,导致插件提供的响应式 API 不可用

@antfu
Copy link
Member

antfu commented Dec 26, 2021

Can you explain a bit why this fixes the issue?

@liyongning
Copy link
Contributor Author

Can you explain a bit why this fixes the issue?

Sorry,I remember you speak Chinese, so I will reply to you in Chinese.

针对这个 bug 出现的原因,我在 Issue 里有很详细的描述,这里就不再复述了,针对你的疑问,我接着 Issue 回复:

因为 vueConstructor 在子应用之间是隔离的,在子应用注册插件时,虽然 has(Vue, PluginInstallFlag) 会返回 true,但是这时的 vueConstructornull,这样 isVueRegistered 就会返回 falseinstall 方法就会继续往下执行,在 setVueConstructor 方法中完成对 vueConstructor 变量的赋值,由此后续的响应式 API,比如 reactive 就不会报 No vue dependence found 错误了。

@antfu antfu changed the title fix: #876 fix: improve register check, close #876 Dec 27, 2021
@antfu antfu merged commit 3c2ad93 into vuejs:main Dec 27, 2021
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.

None yet

2 participants