feat: multiple preload entry
This commit is contained in:
		
							parent
							
								
									714be1985d
								
							
						
					
					
						commit
						c39f0607b2
					
				| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
 | 
					import { join } from 'path'
 | 
				
			||||||
import { builtinModules } from 'module'
 | 
					import { builtinModules } from 'module'
 | 
				
			||||||
import { defineConfig } from 'vite'
 | 
					import { defineConfig } from 'vite'
 | 
				
			||||||
import pkg from '../../package.json'
 | 
					import pkg from '../../package.json'
 | 
				
			||||||
| 
						 | 
					@ -6,13 +7,19 @@ export default defineConfig({
 | 
				
			||||||
  root: __dirname,
 | 
					  root: __dirname,
 | 
				
			||||||
  build: {
 | 
					  build: {
 | 
				
			||||||
    outDir: '../../dist/preload',
 | 
					    outDir: '../../dist/preload',
 | 
				
			||||||
    lib: {
 | 
					 | 
				
			||||||
      entry: 'index.ts',
 | 
					 | 
				
			||||||
      formats: ['cjs'],
 | 
					 | 
				
			||||||
      fileName: () => '[name].cjs',
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    minify: process.env./* from mode option */NODE_ENV === 'production',
 | 
					    minify: process.env./* from mode option */NODE_ENV === 'production',
 | 
				
			||||||
 | 
					    // https://github.com/caoxiemeihao/electron-vue-vite/issues/61
 | 
				
			||||||
 | 
					    sourcemap: 'inline',
 | 
				
			||||||
    rollupOptions: {
 | 
					    rollupOptions: {
 | 
				
			||||||
 | 
					      input: {
 | 
				
			||||||
 | 
					        // multiple entry
 | 
				
			||||||
 | 
					        index: join(__dirname, 'index.ts'),
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      output: {
 | 
				
			||||||
 | 
					        format: 'cjs',
 | 
				
			||||||
 | 
					        entryFileNames: '[name].cjs',
 | 
				
			||||||
 | 
					        manualChunks: {},
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
      external: [
 | 
					      external: [
 | 
				
			||||||
        'electron',
 | 
					        'electron',
 | 
				
			||||||
        ...builtinModules,
 | 
					        ...builtinModules,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue