Yuki Takei 3 лет назад
Родитель
Сommit
7506be9707

+ 3 - 0
packages/app/src/client/services/activate-plugin.ts

@@ -3,6 +3,7 @@ import path from 'path';
 
 import { CustomWindow } from '~/interfaces/global';
 import { GrowiPlugin } from '~/interfaces/plugin';
+import { initializeGrowiFacade } from '~/utils/growi-facade';
 import { resolveFromRoot } from '~/utils/project-dir-utils';
 
 
@@ -24,6 +25,8 @@ export class ActivatePluginService {
   }
 
   static activateAll(): void {
+    initializeGrowiFacade();
+
     const { pluginActivators } = window as CustomWindow;
 
     if (pluginActivators == null) {

+ 10 - 2
packages/app/src/utils/growi-facade.ts

@@ -3,14 +3,22 @@ import deepmerge from 'ts-deepmerge';
 
 import { CustomWindow } from '~/interfaces/global';
 
-export const getGrowiFacade = (): GrowiFacade => {
+export const initializeGrowiFacade = (): void => {
   if (isServer()) {
-    return {};
+    return;
   }
 
   if ((window as CustomWindow).growiFacade == null) {
     (window as CustomWindow).growiFacade = {};
   }
+};
+
+export const getGrowiFacade = (): GrowiFacade => {
+  if (isServer()) {
+    return {};
+  }
+
+  initializeGrowiFacade();
 
   return (window as CustomWindow).growiFacade;
 };