Files
Ivan Fontosh e39a72206d feat: boot-экран, стабильность Windows и оптимизация Pixi/пульта
- Экран загрузки (boot.html, bootWindow): статусы, ensureRoots и проверка лицензии, редактор после готовности; закрытие через destroy при closable:false.

- Упакованное приложение на Windows: disableHardwareAcceleration, sandbox выкл. вне dev, отложенный показ редактора, ensureWindowBecomesVisible, фокус на splash при second-instance.

- Vite: вход boot.html; eslint: игнор release/; тесты boot и maxFPS тикера.

- Пульт: позиция курсора кисти через ref/DOM без setState на каждый move; черновик эффекта через rAF; Pixi: maxFPS 32, resolution cap, antialias off, debounce ResizeObserver, меньше частиц poisonCloud, contain на хосте.

Made-with: Cursor
2026-04-20 12:12:01 +08:00

65 lines
2.1 KiB
TypeScript

import path from 'node:path';
import strip from '@rollup/plugin-strip';
import react from '@vitejs/plugin-react';
import { defineConfig, type Plugin } from 'vite';
/**
* Vite в проде вешает `crossorigin` на script/link; при открытии HTML через `file://` в Electron
* на Windows это часто приводит к тихому отказу загрузки ES-модулей (чёрный экран). macOS может «проглатывать».
*/
function stripCrossoriginForElectronFile(): Plugin {
return {
name: 'strip-crossorigin-electron-file',
enforce: 'post',
apply: 'build',
transformIndexHtml(html) {
return html.replace(/\s+crossorigin(?:=["']?[^"'>\s]+["']?)?/gi, '');
},
};
}
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]),
...(isProd ? [stripCrossoriginForElectronFile()] : []),
],
build: {
outDir: path.resolve(__dirname, 'dist/renderer'),
emptyOutDir: true,
sourcemap: !isProd,
rollupOptions: {
plugins: isProd
? [
strip({
sourceMap: false,
debugger: true,
functions: ['console.*', 'assert.*'],
}),
]
: [],
input: {
boot: path.resolve(__dirname, 'app/renderer/boot.html'),
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,
},
};
});