[READ-ONLY] Mirror of https://github.com/probablykasper/vite-plugin-electron-x. A Vite plugin for bundling main.ts, preload.ts and running Electron in development
0

Configure Feed

Select the types of activity you want to include in your feed.

Add `minify` option

Kasper (Aug 30, 2022, 9:59 PM +0200) f5656096 52ee850c

+10 -6
+1
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 3 ## Next 4 + - Add `minify` option 4 5 - Export `Option` types 5 6 - Fix sourcemap option 6 7
+6 -6
src/index.ts
··· 6 6 7 7 export type { Options, DevOptions, BuildOptions } from './options' 8 8 9 - async function build(options: Required<BuildOptions>, viteConfig: ResolvedConfig): Promise<string> { 9 + async function build(options: Required<BuildOptions>): Promise<string> { 10 10 const output = await viteBuild({ 11 11 configFile: false, 12 12 publicDir: false, ··· 14 14 plugins: options.plugins, 15 15 build: { 16 16 target: options.target, 17 - minify: viteConfig.build.minify, 17 + minify: options.minify, 18 18 emptyOutDir: false, 19 19 sourcemap: options.sourcemap, 20 20 outDir: options.outDir, ··· 108 108 const resolvedOptions = resolveOptions(options, viteConfig) 109 109 await handleOutDirCleaning(resolvedOptions, viteConfig) 110 110 if (resolvedOptions.main !== false) { 111 - await build(resolvedOptions.main, viteConfig) 111 + await build(resolvedOptions.main) 112 112 } 113 113 if (resolvedOptions.preload) { 114 - await build(resolvedOptions.preload, viteConfig) 114 + await build(resolvedOptions.preload) 115 115 } 116 116 }, 117 117 } ··· 135 135 136 136 await handleOutDirCleaning(resolvedOptions, viteConfig) 137 137 if (resolvedOptions.main !== false) { 138 - const outputEntry = await build(resolvedOptions.main, viteConfig) 138 + const outputEntry = await build(resolvedOptions.main) 139 139 if (resolvedOptions.dev !== false) { 140 140 resolvedOptions.dev.entry = outputEntry 141 141 } 142 142 } 143 143 if (resolvedOptions.preload) { 144 - await build(resolvedOptions.preload, viteConfig) 144 + await build(resolvedOptions.preload) 145 145 } 146 146 147 147 if (resolvedOptions.dev !== false) {
+3
src/options.ts
··· 33 33 target?: ViteBuildOptions['target'] 34 34 /** Override Vite's sourcemap option */ 35 35 sourcemap?: ViteBuildOptions['sourcemap'] 36 + /** Override Vite's sourcemap option */ 37 + minify?: ViteBuildOptions['minify'] 36 38 /** Specify dependencies that shouldn't be bundled. 37 39 * 38 40 * **If you use a function, you will need to externalize Electron and Node.js buitlins yourself** ··· 61 63 entry: options.entry, 62 64 external: options.external || [], 63 65 sourcemap: options.sourcemap || viteConfig.build.sourcemap, 66 + minify: options.minify || viteConfig.build.minify, 64 67 plugins: options.plugins || [], 65 68 target: options.target || 'node16', 66 69 }