From ec1ee4ef5d814f9d2a01fd6db665e4200da5bfa9 Mon Sep 17 00:00:00 2001 From: Tareq Imbasher Date: Sat, 8 Jun 2024 22:51:47 +0300 Subject: [PATCH] Fix web version 'process' pollyfill --- .../App/src/core/@common/utils/system.ts | 12 +++++++----- src/Apps/NetPad.Apps.App/App/webpack.config.js | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Apps/NetPad.Apps.App/App/src/core/@common/utils/system.ts b/src/Apps/NetPad.Apps.App/App/src/core/@common/utils/system.ts index d7747dfd..0ab261c2 100644 --- a/src/Apps/NetPad.Apps.App/App/src/core/@common/utils/system.ts +++ b/src/Apps/NetPad.Apps.App/App/src/core/@common/utils/system.ts @@ -1,5 +1,3 @@ -import * as process from "process"; - export class System { /** * Opens a URL in system-configured default browser. @@ -15,9 +13,13 @@ export class System { } public static getPlatform() { - try { - return process.platform; - } catch { + if (this.isRunningInElectron()) { + try { + return require("process").platform; + } catch { + return undefined; + } + } else { return undefined; } } diff --git a/src/Apps/NetPad.Apps.App/App/webpack.config.js b/src/Apps/NetPad.Apps.App/App/webpack.config.js index 91c1427d..c6c5798c 100644 --- a/src/Apps/NetPad.Apps.App/App/webpack.config.js +++ b/src/Apps/NetPad.Apps.App/App/webpack.config.js @@ -58,6 +58,7 @@ module.exports = function (env, {analyze}) { ], fallback: { "fs": false, + "process": false, "path": require.resolve("path-browserify"), }, alias: {