Skip to content

Commit 815bf67

Browse files
committed
fix: allows setting _appConfig if it was undefined before
1 parent 7b22589 commit 815bf67

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app-config-rollup/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ export default function appConfigRollup({
5959
const config = (globalNamespace.${privateName} || configValue);
6060
6161
// if the global is frozen then it was set by electron and we can't change it, but we'll set it if we can
62-
if (!Object.isFrozen(globalNamespace.${privateName})) {
62+
if (
63+
typeof globalNamespace.${privateName} === 'undefined' ||
64+
!Object.isFrozen(globalNamespace.${privateName})
65+
) {
6366
globalNamespace.${privateName} = config;
6467
}
6568
`;

app-config-webpack/src/loader.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ const loader = function AppConfigLoader(this: Loader) {
4848
const config = (globalNamespace.${privateName} || configValue);
4949
5050
// if the global is frozen then it was set by electron and we can't change it, but we'll set it if we can
51-
if (!Object.isFrozen(globalNamespace.${privateName})) {
51+
if (
52+
typeof globalNamespace.${privateName} === 'undefined' ||
53+
!Object.isFrozen(globalNamespace.${privateName})
54+
) {
5255
globalNamespace.${privateName} = config;
5356
}
5457

0 commit comments

Comments
 (0)