[pixi][phaser][threejs] Fixed "ReferenceError: window is not defined" in Node.js environment. See #2409 (#2410)

This commit is contained in:
Vadim Goncharov 2023-11-06 13:41:47 +03:00 committed by GitHub
parent 1cc01d6c6b
commit 09bb49b5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@
declare global {
var require: any;
}
if (window.Phaser) {
if (typeof window !== 'undefined' && window.Phaser) {
let prevRequire = window.require;
window.require = (x: string) => {
if (prevRequire) return prevRequire(x);

View File

@ -32,7 +32,7 @@ declare global {
var PIXI: any;
}
if (window.PIXI) {
if (typeof window !== 'undefined' && window.PIXI) {
let prevRequire = window.require;
window.require = (x: string) => {
if (prevRequire) return prevRequire(x);

View File

@ -31,7 +31,7 @@ declare global {
var require: any;
}
if (window.THREE) {
if (typeof window !== 'undefined' && window.THREE) {
let prevRequire = window.require;
window.require = (x: string) => {
if (prevRequire) return prevRequire(x);