aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/esbuild.config.js
blob: d5f6f1e9a816d0a7e77535849610bd311ffab5cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import getRepoInfo from 'git-repo-info';

import { node } from '../../config/buildConstants.js';
import fileURLToDirname from '../../config/fileURLToDirname.js';
import getEsbuildConfig from '../../config/getEsbuildConfig.js';

const externalPackages = ['electron'];

if (process.env.MODE !== 'development') {
  externalPackages.push('electron-devtools-installer');
}

const gitInfo = getRepoInfo();

export default getEsbuildConfig(
  {
    absWorkingDir: fileURLToDirname(import.meta.url),
    entryPoints: ['src/index.ts'],
    outfile: 'dist/index.cjs',
    format: 'cjs',
    platform: 'node',
    target: node,
    external: externalPackages,
  },
  {
    VITE_DEV_SERVER_URL: process.env.VITE_DEV_SERVER_URL || null,
    GIT_SHA: gitInfo.abbreviatedSha,
    GIT_BRANCH: gitInfo.branch,
    BUILD_DATE: new Date().getTime(),
  },
);