-
Notifications
You must be signed in to change notification settings - Fork 0
/
electron.vite.config.js
46 lines (43 loc) · 1.29 KB
/
electron.vite.config.js
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
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import vitePluginRequire from "vite-plugin-require";
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy'
// import { visualizer } from "rollup-plugin-visualizer"
function myPlug(){
console.log("vite____________",__dirname)
}
export default defineConfig({
main: {
build: {
rollupOptions: {
output: {
chunkFileNames: '[name].js',
manualChunks: (id) => {
if(id.includes('player')) return 'mpv/player'
}
}
}
},
plugins: [commonjs(),vitePluginRequire(),externalizeDepsPlugin(),nodePolyfills()],
resolve: {
// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.
browserField: false,
conditions: ['node'],
mainFields: ['module', 'jsnext:main', 'jsnext'],
},
},
preload: {
plugins: [externalizeDepsPlugin(),vitePluginRequire(),nodePolyfills()]
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('src/renderer/src')
}
},
plugins: [react(),nodePolyfills()]
}
})