Skip to content

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

3 participants