-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.preload.config.js
34 lines (32 loc) · 977 Bytes
/
vite.preload.config.js
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 { defineConfig, mergeConfig } from 'vite';
import {
getBuildConfig,
external,
pluginHotRestart,
} from './vite.base.config.js';
// https://vitejs.dev/config
export default defineConfig((env) => {
/** @type {import('vite').ConfigEnv<'build'>} */
const forgeEnv = env;
const { forgeConfigSelf } = forgeEnv;
/** @type {import('vite').UserConfig} */
const config = {
build: {
rollupOptions: {
external,
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
input: forgeConfigSelf.entry,
output: {
format: 'cjs',
// It should not be split chunks.
inlineDynamicImports: true,
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
},
},
},
plugins: [pluginHotRestart('reload')],
};
return mergeConfig(getBuildConfig(forgeEnv), config);
});