48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import path from 'node:path';
|
|
|
|
import strip from '@rollup/plugin-strip';
|
|
import react from '@vitejs/plugin-react';
|
|
import { defineConfig } from 'vite';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const isProd = mode === 'production';
|
|
|
|
return {
|
|
/** Иначе в упакованном Electron `file://` запросы идут в `/assets/...` с корня диска — чёрный экран. */
|
|
base: isProd ? './' : '/',
|
|
root: path.resolve(__dirname, 'app/renderer'),
|
|
plugins: [
|
|
react({
|
|
babel: {
|
|
plugins: [['babel-plugin-react-compiler', { target: '19' }]],
|
|
},
|
|
} as Parameters<typeof react>[0]),
|
|
],
|
|
build: {
|
|
outDir: path.resolve(__dirname, 'dist/renderer'),
|
|
emptyOutDir: true,
|
|
sourcemap: !isProd,
|
|
rollupOptions: {
|
|
plugins: isProd
|
|
? [
|
|
strip({
|
|
sourceMap: false,
|
|
debugger: true,
|
|
functions: ['console.*', 'assert.*'],
|
|
}),
|
|
]
|
|
: [],
|
|
input: {
|
|
editor: path.resolve(__dirname, 'app/renderer/editor.html'),
|
|
presentation: path.resolve(__dirname, 'app/renderer/presentation.html'),
|
|
control: path.resolve(__dirname, 'app/renderer/control.html'),
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
strictPort: true,
|
|
},
|
|
};
|
|
});
|