UNPKG

backsplash-app

Version:
81 lines (74 loc) 2.48 kB
import type { ConfigEnv, UserConfig } from "vite"; import { defineConfig, mergeConfig } from "vite"; // import { checker } from "vite-plugin-checker"; import viteTsconfigPaths from "vite-tsconfig-paths"; import { sentryVitePlugin } from "@sentry/vite-plugin"; import { config } from "dotenv"; import { getBuildConfig, getBuildDefine, external, pluginHotRestart } from "./vite.base.config"; import path from "path"; import { version } from "../package.json"; // Load environment variables config({ path: ".env.production" }); // https://vitejs.dev/config export default defineConfig((env) => { const forgeEnv = env as ConfigEnv<"build">; const { forgeConfigSelf } = forgeEnv; const define = getBuildDefine(forgeEnv); const config: UserConfig = { build: { sourcemap: true, lib: { entry: forgeConfigSelf.entry!, fileName: () => "[name].js", formats: ["cjs"], }, rollupOptions: { external, input: { main: path.resolve(__dirname, "../src/main.ts"), wallpaperWorker: path.resolve(__dirname, "../src/ipc/services/wallpaperWorker.ts"), }, output: { entryFileNames: "[name].js", }, }, }, plugins: [ pluginHotRestart("restart"), viteTsconfigPaths(), // checker({ // typescript: true, // eslint: { // lintCommand: 'eslint "./**/*.{ts,tsx}"', // }, // }), // Put the Sentry vite plugin after all other plugins process.env.SENTRY_AUTH_TOKEN && (() => { console.log('🔍 Loading Sentry plugin for main process with auth token:', process.env.SENTRY_AUTH_TOKEN?.substring(0, 10) + '...'); return sentryVitePlugin({ authToken: process.env.SENTRY_AUTH_TOKEN, org: "james-julius-darby-development", project: "backsplash", // Set release name based on app version release: { name: version, }, // Debug and output settings debug: true, silent: false, // Disable telemetry telemetry: false, }); })(), ].filter(Boolean), // Remove falsy values from plugins array define, resolve: { // Load the Node.js entry. alias: { "@": path.resolve(__dirname, "../src"), }, mainFields: ["module", "jsnext:main", "jsnext"], }, }; return mergeConfig(getBuildConfig(forgeEnv), config); });