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: the latest vue3 version cause ssr failed, devtools judge in server side is not exact #4890

Merged
merged 2 commits into from Nov 15, 2021

Conversation

zhangyuang
Copy link
Contributor

The latest version of vue3 cause ssr failed, devtools judge in server side is not exact. Mock window object is common in some ssr program for compatibility, maybe only use typeof window as condition is not exact

@posva posva added the need more info Further information is requested label Nov 3, 2021
@posva
Copy link
Member

posva commented Nov 3, 2021

Mock window object is common in some ssr program for compatibility

I would say it's the opposite: Mocking the window object in Node.js is mostly done for testing but should be avoided as it will break many universal libraries relying on that check.
Checking typeof navigator is another possibility

@zhangyuang
Copy link
Contributor Author

zhangyuang commented Nov 3, 2021

@posva yeah,i will remove window dependencies in next version,but many third party ui component depend on window property and the code maybe not be written in component lifecycle but component top.

Navigator also be mocked commonly. window.htmlelememt looks like a safe condition

@zhangyuang
Copy link
Contributor Author

zhangyuang commented Nov 3, 2021

Mock window object is common in some ssr program for compatibility

I would say it's the opposite: Mocking the window object in Node.js is mostly done for testing but should be avoided as it will break many universal libraries relying on that check. Checking typeof navigator is another possibility

emmm,mock navigator.useragent is also common,what’s your opinion about the judge condition

@yyx990803 yyx990803 merged commit fa2237f into vuejs:master Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants