-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.main.config.ts
More file actions
41 lines (36 loc) · 878 Bytes
/
vite.main.config.ts
File metadata and controls
41 lines (36 loc) · 878 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
32
33
34
35
36
37
38
39
40
41
// Vite configuration for the Electron main process bundle.
import path from 'node:path';
import { defineConfig, type Plugin } from 'vite';
import { isExternalModuleId } from './build/external-modules';
/** Externalizes configured modules. */
function externalizeConfiguredModules(): Plugin {
return {
enforce: 'pre',
name: 'externalize-configured-modules',
resolveId(source) {
if (isExternalModuleId(source)) {
return {
external: true,
id: source,
};
}
return null;
},
};
}
export default defineConfig({
plugins: [externalizeConfiguredModules()],
build: {
rollupOptions: {
external: (importId) => isExternalModuleId(importId),
output: {
entryFileNames: 'main.js',
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
});