Selaa lähdekoodia

ts: Enable the use of workspaces in electron projects (#380)

John Rees 4 vuotta sitten
vanhempi
sitoutus
e11b4ae790
1 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  1. 5 2
      ts/src/workspace.ts

+ 5 - 2
ts/src/workspace.ts

@@ -19,8 +19,11 @@ const workspace = new Proxy({} as any, {
     const fs = require("fs");
     const process = require("process");
 
-    if (typeof window !== "undefined") {
-      // Workspaces aren't available in the browser, yet.
+    if (
+      typeof window !== "undefined" &&
+      !window.process?.hasOwnProperty("type")
+    ) {
+      // Workspaces are available in electron, but not in the browser, yet.
       return undefined;
     }