1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Setting up environment prop

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-07-05 13:30:19 +03:00 committed by Hung-Han (Henry) Chen
parent f7bcad0717
commit 0105c66c9f
No known key found for this signature in database
GPG Key ID: 54B44603D251B788
4 changed files with 9 additions and 25 deletions

View File

@ -26,7 +26,7 @@ import * as Mobx from "mobx";
import * as LensExtensionsCommonApi from "../extensions/common-api";
import * as LensExtensionsMainApi from "../extensions/main-api";
import { app, autoUpdater, dialog, powerMonitor } from "electron";
import { appName, isMac, productName, dsn } from "../common/vars";
import { appName, isMac, productName, dsn, isProduction } from "../common/vars";
import path from "path";
import { LensProxy } from "./proxy/lens-proxy";
import { WindowManager } from "./window-manager";
@ -62,12 +62,7 @@ import { FilesystemProvisionerStore } from "./extension-filesystem";
import { CaptureConsole, Dedupe, Offline } from "@sentry/integrations";
// Initializing Sentry
const Sentry =
// prevent `TypeError: mod.require is not a function`
// see https://docs.sentry.io/platforms/javascript/guides/electron/#webpack-configuration
process.type === "main"
? require("@sentry/electron/dist/main")
: require("@sentry/electron/dist/renderer");
const Sentry = require("@sentry/electron/dist/main");
Sentry.init({
dsn,
@ -82,7 +77,8 @@ Sentry.init({
"rocess.env.NODE_ENV": process.env.NODE_ENV,
"process.env.CICD": process.env.CICD
}
}
},
environment: isProduction ? "production" : "development"
});
const workingDir = path.join(app.getPath("appData"), appName);

View File

@ -36,16 +36,11 @@ import { registerIpcHandlers } from "./ipc";
import { ipcRenderer } from "electron";
import { IpcRendererNavigationEvents } from "./navigation/events";
import { catalogEntityRegistry } from "./api/catalog-entity-registry";
import { dsn } from "../common/vars";
import { dsn, isProduction } from "../common/vars";
import { CaptureConsole, Dedupe, Offline } from "@sentry/integrations";
// Initializing Sentry
const Sentry =
// prevent `TypeError: mod.require is not a function`
// see https://docs.sentry.io/platforms/javascript/guides/electron/#webpack-configuration
process.type === "main"
? require("@sentry/electron/dist/main")
: require("@sentry/electron/dist/renderer");
const Sentry = require("@sentry/electron/dist/renderer");
Sentry.init({
dsn,
@ -60,7 +55,8 @@ Sentry.init({
"rocess.env.NODE_ENV": process.env.NODE_ENV,
"process.env.CICD": process.env.CICD
}
}
},
environment: isProduction ? "production" : "development"
});
@observer

View File

@ -20,7 +20,7 @@
*/
import path from "path";
import webpack from "webpack";
import type webpack from "webpack";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import { isProduction, mainDir, buildDir, isDevelopment } from "./src/common/vars";
import nodeExternals from "webpack-node-externals";
@ -62,9 +62,6 @@ export default function (): webpack.Configuration {
plugins: [
new ProgressBarPlugin(),
new ForkTsCheckerPlugin(),
new webpack.DefinePlugin({
"process.type": '"main"',
}),
].filter(Boolean)
};
}

View File

@ -174,11 +174,6 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
isDevelopment && new webpack.HotModuleReplacementPlugin(),
isDevelopment && new ReactRefreshWebpackPlugin(),
new webpack.DefinePlugin({
"process.type": '"renderer"',
}),
].filter(Boolean),
};
}