File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,13 @@ export type Namespace = {
1515} ;
1616
1717const initializeGlobalNamespace = ( ) => {
18- let holder = window ;
18+ let holder : any ;
1919
2020 // if there is no window obj use nodejs global lib variable
21- if ( typeof holder !== 'object' ) {
21+ if ( window && typeof window !== 'object' ) {
2222 holder = globalHolder ;
23+ } else {
24+ holder = window
2325 }
2426
2527 // @ts -ignore
@@ -82,7 +84,7 @@ export const loadModules = (modulesList) => Promise.all(modulesList.map(({ id, u
8284 * @param {* } url
8385 */
8486export const loadModule = ( id : string , url : string ) => {
85- if ( typeof window !== 'object' ) {
87+ if ( window && typeof window !== 'object' ) {
8688 return Promise . reject ( new Error ( 'Load module is working only on browser env' ) ) ;
8789 }
8890
@@ -152,7 +154,7 @@ export const loadModule = (id: string, url: string) => {
152154 */
153155export const registerModule = ( id : string , instance : any , metadata ?: any ) => {
154156 // loader not working on nodejs envs
155- if ( typeof window !== 'object' ) {
157+ if ( window && typeof window !== 'object' ) {
156158 return ;
157159 }
158160
You can’t perform that action at this time.
0 commit comments