diff --git a/src/ol/index.js b/src/ol/index.js index f2e44acc19..377d594239 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -41,7 +41,7 @@ let WEBGL_EXTENSIONS; // value is set below let HAS_WEBGL = false; -if ('WebGLRenderingContext' in window) { +if (typeof window !== 'undefined' && 'WebGLRenderingContext' in window) { try { const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('CANVAS'));