startElectron.ts 589 B

12345678910111213141516171819202122
  1. import { createServer } from 'vite';
  2. import path from 'path';
  3. import { startCompilerElectron } from './compilerElectron';
  4. import minimist from 'minimist';
  5. (async () => {
  6. const argv = minimist(process.argv.slice(2));
  7. console.log(argv);
  8. const isDev = argv.env === 'development';
  9. let port: number | undefined = undefined;
  10. if (isDev) {
  11. const server = await createServer({
  12. root: path.resolve(__dirname, '../../'),
  13. });
  14. const app = await server.listen();
  15. port = app.config.server.port;
  16. process.env.PORT = `${port}`;
  17. }
  18. startCompilerElectron(port);
  19. })();