refactor(desktop): replace resolve-env with build-time dotenv injection

This commit is contained in:
CREDO23 2026-03-18 19:27:53 +02:00
parent 14b561bc39
commit c8d6883474
7 changed files with 27 additions and 88 deletions

View file

@ -1,6 +1,9 @@
import { build } from 'esbuild';
import fs from 'fs';
import path from 'path';
import dotenv from 'dotenv';
const desktopEnv = dotenv.config().parsed || {};
const STANDALONE_ROOT = path.join(
'..', 'surfsense_web', '.next', 'standalone', 'surfsense_web'
@ -104,6 +107,11 @@ async function buildElectron() {
external: ['electron'],
sourcemap: true,
minify: false,
define: {
'process.env.HOSTED_FRONTEND_URL': JSON.stringify(
desktopEnv.HOSTED_FRONTEND_URL || 'https://surfsense.net'
),
},
};
await build({