mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-28 07:39:13 +01:00
32 lines
580 B
TypeScript
32 lines
580 B
TypeScript
/**
|
|
* @file
|
|
* @copyright 2020 Aleksej Komarov
|
|
* @license MIT
|
|
*/
|
|
|
|
import fs from 'node:fs';
|
|
|
|
import { reloadByondCache } from './reloader';
|
|
import { RspackCompiler } from './webpack';
|
|
|
|
const reloadOnce = process.argv.includes('--reload');
|
|
|
|
async function setupServer() {
|
|
fs.mkdirSync('./public/.tmp', { recursive: true });
|
|
|
|
const compiler = new RspackCompiler();
|
|
|
|
await compiler.setup();
|
|
|
|
// Reload cache once
|
|
if (reloadOnce) {
|
|
await reloadByondCache(compiler.bundleDir);
|
|
return;
|
|
}
|
|
|
|
// Run a development server
|
|
await compiler.watch();
|
|
}
|
|
|
|
setupServer();
|