Skip to content

Commit

Permalink
chheck for is_electron
Browse files Browse the repository at this point in the history
Fixes issue with latest electron.

requirejs#147
  • Loading branch information
mafar authored Feb 20, 2023
1 parent 3f9d4c1 commit 5321e99
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions text.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,19 @@ define(['module'], function (module) {
}, config);
}
};

if (masterConfig.env === 'node' || (!masterConfig.env &&
function isElectron() {
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
return true;
}
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
return true;
}
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
return true;
}
return false;
}
if (masterConfig.env === 'node' || (!isElectron() && !masterConfig.env &&
typeof process !== "undefined" &&
process.versions &&
!!process.versions.node &&
Expand Down

0 comments on commit 5321e99

Please sign in to comment.