-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheevi.config.ts
34 lines (30 loc) · 1.04 KB
/
eevi.config.ts
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
32
33
34
import { join, resolve } from 'path'
import fs from 'fs'
import type { UserConfigExport } from 'eevi'
import { defineConfig } from 'eevi'
import { ElectronPreloadPlugin } from '@eevi/elexpose/esbuild'
import { alias } from './alias'
const appPath = resolve(process.cwd(), 'release', 'app')
const packagePath = resolve(appPath, 'package.json')
const { dependencies } = JSON.parse(fs.readFileSync(packagePath, 'utf-8') || '{}')
const define = {
'process.env.URL': process.env.MODE === 'mpa' ? '\'./dist/pages\'' : '\'./dist/index.html\'',
'process.env.MODE': process.env.MODE === 'mpa' ? '\'mpa\'' : '\'spa\'',
}
if (process.env.NODE_ENV === 'development')
delete define['process.env.URL']
export default defineConfig({
root: 'app/electron',
entry: 'main.ts',
outDir: join(appPath, 'dist'),
preloadEntries: [
'../compat/preload/*.ts', // eevi v0.7.0
],
preloadPlugins: [ElectronPreloadPlugin()],
resolve: {
alias,
},
external: [...Object.keys(dependencies || {})],
tsconfig: 'tsconfig.json',
define,
}) as UserConfigExport