File tree Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Expand file tree Collapse file tree 3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1+ ## 0.28.7 (2024-04-27)
2+
3+ - b3cf74c chore: cleanup, code format
4+ - 957b144 Merge pull request #233 from kuoruan/feat/config
5+ - c0f2647 feat: inherit more config from base user config
6+
7+ ** Contributors:**
8+
9+ - [ #233 ] ( https://github.com/electron-vite/vite-plugin-electron/pull/233 ) @[ kuoruan] ( https://github.com/kuoruan )
10+
111## 0.28.6 (2024-04-21)
212
313- be94383 fix: ` ElectronOptions['startup'] ` definition
Original file line number Diff line number Diff line change 11{
22 "name" : " vite-plugin-electron" ,
3- "version" : " 0.28.6 " ,
3+ "version" : " 0.28.7 " ,
44 "description" : " Electron 🔗 Vite" ,
55 "main" : " ./dist/index.js" ,
66 "types" : " ./dist/index.d.ts" ,
Original file line number Diff line number Diff line change 11import {
22 type Plugin ,
3- build as viteBuild ,
3+ type ConfigEnv ,
44 type UserConfig ,
5+ build as viteBuild ,
56} from 'vite'
67import {
78 resolveServerUrl ,
@@ -48,8 +49,8 @@ export function build(options: ElectronOptions) {
4849
4950export default function electron ( options : ElectronOptions | ElectronOptions [ ] ) : Plugin [ ] {
5051 const optionsArray = Array . isArray ( options ) ? options : [ options ]
51- let mode : string
5252 let userConfig : UserConfig
53+ let configEnv : ConfigEnv
5354
5455 return [
5556 {
@@ -70,9 +71,11 @@ export default function electron(options: ElectronOptions | ElectronOptions[]):
7071 options . vite . root ??= server . config . root
7172 options . vite . envDir ??= server . config . envDir
7273 options . vite . envPrefix ??= server . config . envPrefix
74+
7375 options . vite . build ??= { }
7476 options . vite . build . watch ??= { }
7577 options . vite . build . minify ??= false
78+
7679 options . vite . plugins ??= [ ]
7780 options . vite . plugins . push (
7881 {
@@ -107,14 +110,15 @@ export default function electron(options: ElectronOptions | ElectronOptions[]):
107110 apply : 'build' ,
108111 config ( config , env ) {
109112 userConfig = config
113+ configEnv = env
114+
110115 // Make sure that Electron can be loaded into the local file using `loadFile` after packaging.
111116 config . base ??= './'
112- mode = env . mode
113117 } ,
114118 async closeBundle ( ) {
115119 for ( const options of optionsArray ) {
116120 options . vite ??= { }
117- options . vite . mode ??= mode
121+ options . vite . mode ??= configEnv . mode
118122 options . vite . root ??= userConfig . root
119123 options . vite . envDir ??= userConfig . envDir
120124 options . vite . envPrefix ??= userConfig . envPrefix
You can’t perform that action at this time.
0 commit comments