-
Notifications
You must be signed in to change notification settings - Fork 7
/
electron.vite.config.ts
executable file
·91 lines (90 loc) · 2.52 KB
/
electron.vite.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin, splitVendorChunkPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import vuetify from 'vite-plugin-vuetify'
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin({exclude: ['@ngageoint/geopackage/dist/canvaskit/canvaskit.js', 'fetch']})],
optimizeDeps: {
disabled: false,
},
build: {
// commonjsOptions: {
// include: ['node_modules/wkx/**','node_modules/ol-format-node/**/*'],
// transformMixedEsModules: true,
// extensions: ['.js','.d.ts']
// },
rollupOptions: {
input: {
index: resolve(__dirname, 'src/main/main.js'),
mapcacheThread: resolve(__dirname, 'src/lib/threads/mapcacheThread.js')
},
output: {
dir: 'dist/main',
format: 'cjs'
}
},
outDir: 'dist/main'
},
resolve: {
mainFields: ['module', 'main', 'browser'],
browserField: false
},
},
preload: {
plugins: [externalizeDepsPlugin()],
build: {
rollupOptions: {
input: {
mainPreload: resolve(__dirname, 'src/preload/mainPreload.js'),
projectPreload: resolve(__dirname, 'src/preload/projectPreload.js'),
featureTablePreload: resolve(__dirname, 'src/preload/featureTablePreload.js'),
userGuidePreload: resolve(__dirname, 'src/preload/userGuidePreload.js'),
workerPreload: resolve(__dirname, 'src/preload/workerPreload.js')
}
},
outDir: 'dist/preload'
},
resolve: {
mainFields: ['module', 'main', 'browser'],
browserField: false
}
},
renderer: {
root: 'src/renderer',
resolve: {
alias: {
'@renderer': resolve('src/renderer/src')
}
},
build: {
outDir: 'dist/renderer',
rollupOptions: {
input: {
index: resolve(__dirname, 'src/renderer/index.html'),
loader: resolve(__dirname, 'src/renderer/loader.html')
}
}
},
plugins: [
vue(),
vuetify({ autoImport: true }),
splitVendorChunkPlugin()
],
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
})
]
}
},
}
})