forked from electron-vite/vite-plugin-electron-renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
38 lines (37 loc) · 1.02 KB
/
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
import { defineConfig } from 'vite'
import electron from 'vite-plugin-electron'
import renderer from 'vite-plugin-electron-renderer'
import pkg from './package.json'
export default defineConfig({
plugins: [
electron({
entry: 'electron/main.ts',
}),
renderer({
// Enables use of Node.js API in the Renderer-process
nodeIntegration: true,
// Like Vite's pre bundling
optimizeDeps: {
include: [
'serialport', // cjs(C++)
'electron-store', // cjs
'execa', // esm
'got', // esm
'node-fetch', // esm
],
},
}),
],
build: {
minify: false,
rollupOptions: {
external: Object.keys(pkg.dependencies),
},
},
optimizeDeps: {
// If an npm package is a pure ESM format package,
// and the packages it depends on are also in ESM format,
// then put it in `optimizeDeps.exclude` and it will work normally.
// exclude: ['only-support-pure-esmodule-package'],
},
})