Closed RyanWarner closed 3 years ago
Screenfull is meant to run in a browser. The previous version did indeed polyfill document
, but I no longer think that's the correct place to handle it. If you want to run a browser-based library on the server, it's up to you to polyfill the required globals.
I updated from 5.1.0 to 6.0.0 and am now getting the error
ReferenceError: document is not defined
during server side rendering in a NextJS app.
Dear @RyanWarner I'm meet this problem, Can you help me fix this problem, Please.
@tranmanhhung I solved the problem by downgrading back to version 5.1.0.
@tranmanhhung I solved the problem by downgrading back to version 5.1.0.
I just found solved this problem by.. const nativeAPI = (() => { const unprefixedMethods = methodMap[0]; const returnValue = {};
for (const methodList of methodMap) {
const exitFullscreenMethod = methodList?.[1];
if (typeof window === 'object') {
if (exitFullscreenMethod in document) {
for (const [index, method] of methodList.entries()) {
returnValue[unprefixedMethods[index]] = method;
}
return returnValue;
}
}
}
return false;
})();
line 56 added if (typeof window === 'object') {
I updated from 5.1.0 to 6.0.0 and am now getting the error
during server side rendering in a NextJS app.