TypeError: window.matchMedia is not a function
at file:///src/server.js:1105:20
at Object.$$render (file:///src/server.js:184:18)
at file:///src/server.js:1174:55
$: {
if (theme !== 'system') {
actualTheme = theme;
}
if (typeof window !== 'undefined') {
if (theme === 'system') {
// check if current preference is dark
if (window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches) {
// it's currently dark
actualTheme = 'dark';
}
else {
// it's not dark
actualTheme = 'light';
}
}
// next line is 1105
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', ({ matches }) => {
actualTheme = matches ? 'dark' : 'light';
});
}
}
Describe the bug
Reproduction
deploy to deno
Logs
No response
System Info
Severity
annoyance