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(plugin-vite): Ensure rendererUrl is set before calling dev(userCo… #1055

Merged

Conversation

AdamChrist
Copy link
Contributor

起因
详见:ArcherGu/fast-vite-electron#1074 ,在其他电脑(macos)中也复现了该问题。重复启动-停止-启动的过程中有可能会出现该问题。同时我也观察到在日志中 DSB xx 的日志优先 printUrls() 的内容输出时就会报错,也侧面证明了存在竞态条件的问题。

描述
解决了 Vite Plugin Doubleshot 插件中一个潜在的竞态条件问题。在 Vite 开发服务器启动时,rendererUrl 可能在调用 dev(userConfig) 之前没有正确设置,导致 rendererUrl 的值不正确,从而在开发过程中引发问题。

变更内容
• 添加标志:引入了一个 rendererUrlSet 标志,用于跟踪 rendererUrl 是否已被设置。
• 修改 server.printUrls:调整了该方法以设置 rendererUrl 并更新 rendererUrlSet 标志。
• 更新 listening 事件处理器:确保在调用 dev(userConfig) 之前检查 rendererUrlSet 标志,并确保 rendererUrl 已被设置。

@ArcherGu
Copy link
Member

ArcherGu commented Jul 5, 2024

好的,非常感谢!我会尽快发布新版本。

@ArcherGu ArcherGu merged commit 0a83096 into Doubleshotjs:main Jul 5, 2024
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