40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { resolve } from 'node:path';
|
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
// The workspace packages (@wto/patcher, @wto/server) stay external: they ship as
|
|
// TypeScript sources and run on Electron's own Node, which strips the types itself.
|
|
// Bundling them would break the files they find next to their sources.
|
|
export default defineConfig({
|
|
main: {
|
|
plugins: [externalizeDepsPlugin()],
|
|
resolve: { alias: { '@shared': resolve('src/shared') } },
|
|
build: {
|
|
rollupOptions: {
|
|
// Utility process entries sit next to index.js, where the main process forks them.
|
|
input: {
|
|
index: resolve('src/main/index.ts'),
|
|
'build-worker': resolve('src/main/workers/build-worker.ts'),
|
|
'save-worker': resolve('src/main/workers/save-worker.ts'),
|
|
'patch-check-worker': resolve('src/main/workers/patch-check-worker.ts'),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
preload: {
|
|
plugins: [externalizeDepsPlugin()],
|
|
resolve: { alias: { '@shared': resolve('src/shared') } },
|
|
// A sandboxed preload cannot be an ES module.
|
|
build: { rollupOptions: { output: { format: 'cjs', entryFileNames: '[name].cjs' } } },
|
|
},
|
|
renderer: {
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@shared': resolve('src/shared'),
|
|
'@': resolve('src/renderer/src'),
|
|
},
|
|
},
|
|
},
|
|
});
|