-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.preload.config.ts
More file actions
31 lines (30 loc) · 919 Bytes
/
vite.preload.config.ts
File metadata and controls
31 lines (30 loc) · 919 Bytes
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
import { defineConfig } from 'vite';
import { builtinModules } from 'node:module';
export default defineConfig({
build: {
outDir: '.vite/preload',
minify: 'esbuild',
rollupOptions: {
external: ['electron', ...builtinModules.map((m) => [m, `node:${m}`]).flat()],
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
// Also `build.rollupOptions.input` allows for multiple entry points.
// https://rollupjs.org/configuration-options/#input
input: {
'preload': './src-renderer/preload.ts'
},
output: {
format: 'commonjs',
// It should not be split chunks.
inlineDynamicImports: true,
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
},
},
},
resolve: {
// Load the Node.js entry.
mainFields: ['module', 'jsnext:main', 'jsnext'],
},
clearScreen: false,
});