Update all non-major dependencies
[ProtonMail-WebClient.git] / applications / inbox-desktop / webpack.main.config.ts
blob8c06ac971101aefdd02851bb5d77c9d1e18f131e
1 import { DefinePlugin, type Configuration } from "webpack";
2 import { rules } from "./webpack.rules";
3 import { readFileSync } from "node:fs";
4 import { z } from "zod";
5 import { resolve } from "node:path";
7 const AppConfigSchema = z.object({
8     appConfig: z.object({
9         sentryDesktop: z.string(),
10     }),
11 });
13 const APP_CONFIG_PATH = resolve(__dirname, "../../packages/config/mail/appConfig.json");
14 const { appConfig } = AppConfigSchema.parse(JSON.parse(readFileSync(APP_CONFIG_PATH, "utf8")));
15 const sentryDSN = appConfig.sentryDesktop;
17 export const mainConfig: Configuration = {
18     /**
19      * This is the main entry point for your application, it's the first file
20      * that runs in the main process.
21      */
22     entry: "./src/index.ts",
23     // Put your normal webpack config below here
24     module: {
25         rules: [
26             ...rules,
27             {
28                 test: /\.css$/i,
29                 type: "asset/resource",
30             },
31         ],
32     },
33     plugins: [
34         new DefinePlugin({
35             "process.env.BUILD_TAG": JSON.stringify(process.env.BUILD_TAG),
36             "process.env.IDA_TAG": JSON.stringify(process.env.IDA_TAG),
37             "process.env.DESKTOP_SENTRY_DSN": JSON.stringify(sentryDSN),
38         }),
39     ],
40     resolve: {
41         extensions: [".js", ".ts", ".jsx", ".tsx", ".css", ".json"],
42     },