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: $slidev injection, close #679 #683

Merged
merged 2 commits into from Aug 15, 2022
Merged

fix: $slidev injection, close #679 #683

merged 2 commits into from Aug 15, 2022

Conversation

Duanxs
Copy link
Contributor

@Duanxs Duanxs commented Aug 15, 2022

修复 #679
问题原因:
Symbol 惹的祸
全局属性 $slidev 的注入名声明在 packages/client/constants.ts,为 Symbol,其提供于文件 packages/client/modules/context.ts,注入于插件 slidev:layout-transform:pre slidev:context-transform:pre
开发环境下,上述两插件中的依赖项会预编译到 node_modules/.vite/deps,即,constants.ts 暂存位置。提供处仍引用的是 packages/client/constants.ts
此时出现了两份 constants.ts,而 Symbol('slidev-slidev-context') !== Symbol('slidev-slidev-context'),故而报错。

解决办法:
分别配置两插件,在预构建中强制排除依赖项 @slidev/client/constants

@antfu antfu changed the title fix: #679, Fix the $slidev injection option fix: $slidev injection, close #679 Aug 15, 2022
@antfu antfu merged commit cdbee4a into slidevjs:main Aug 15, 2022
@Duanxs Duanxs deleted the fix branch August 15, 2022 17:03
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