-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathvite.preload.config.ts
More file actions
34 lines (31 loc) · 1 KB
/
vite.preload.config.ts
File metadata and controls
34 lines (31 loc) · 1 KB
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
import type { UserConfig } from 'vite';
import { defineConfig, mergeConfig } from 'vite';
import { external, getBuildConfig } from './vite.base';
// https://vitejs.dev/config
export default defineConfig((env) => {
const config: UserConfig = {
build: {
rollupOptions: {
external,
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
input: './src/preload.ts',
output: {
format: 'cjs',
// It should not be split chunks.
inlineDynamicImports: true,
entryFileNames: '[name].cjs',
chunkFileNames: '[name].cjs',
assetFileNames: '[name].[ext]',
},
},
},
// TODO: Not impl. - placeholder for vitest configuration
// Note: tests/preload directory doesn't exist yet
// test: {
// name: 'preload',
// include: ['tests/preload/**/*'],
// environment: 'jsdom',
// },
};
return mergeConfig(getBuildConfig(env), config);
});