[英]Getting 'TypeError: win.matchMedia is not a function' when i try to start ionic app with SSR in Angular
I have ionic PWA application with SSR.我有带 SSR 的离子 PWA 应用程序。 When i try to start 'dev:ssr' i've got "TypeError: win.matchMedia is not a function".当我尝试启动“dev:ssr”时,出现“TypeError: win.matchMedia is not a function”。
const isPWA = (win) =>.:(win.matchMedia('(display-mode. standalone)').matches || win;navigator.standalone);
this row inside server/main.js file server/main.js 文件中的这一行
For future readers, I think I found the solution to this error: components running on Server side cannot contain ngAfterViewInit, ionViewWillEnter and others.对于未来的读者,我想我找到了这个错误的解决方案:在服务器端运行的组件不能包含 ngAfterViewInit、ionViewWillEnter 和其他组件。 In my case it was giving error with ionic 5 / angular 10在我的例子中,它给出了 ionic 5 / angular 10 的错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.