-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.main.config.ts
36 lines (34 loc) · 1.1 KB
/
vite.main.config.ts
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
35
36
import type { ConfigEnv, UserConfig } from 'vite';
import { defineConfig, mergeConfig } from 'vite';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import { external, getBuildConfig, getBuildDefine, pluginHotRestart } from './vite.base.config';
// https://vitejs.dev/config
export default defineConfig(env => {
const forgeEnv = env as ConfigEnv<'build'>;
const { forgeConfigSelf } = forgeEnv;
const define = getBuildDefine(forgeEnv);
const config: UserConfig = {
build: {
lib: {
entry: forgeConfigSelf.entry!,
fileName: () => '[name].js',
formats: ['cjs'],
},
rollupOptions: {
external,
},
},
plugins: [pluginHotRestart('restart'), viteTsconfigPaths()],
define,
resolve: {
// Load the Node.js entry.
browserField: false,
mainFields: ['module', 'jsnext:main', 'jsnext'],
alias: {
'.prisma/client/default': './node_modules/@prisma/client/default.js',
'.prisma/client': './node_modules/@prisma/client/index.js',
},
},
};
return mergeConfig(getBuildConfig(forgeEnv), config);
});