Skip to content

Commit

Permalink
fix: improve server building on watch build
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Dec 30, 2024
1 parent 8d4b67e commit 58d1c01
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { createServer } from "http";
import Fastify from "fastify";
import fastifyStatic from "@fastify/static";
import { join } from "node:path";
import rspackConfig from "./rspack.config.js";
import { rspack } from "@rspack/core";
import { spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
import { server as wisp } from "@mercuryworkshop/wisp-js/server";
Expand Down Expand Up @@ -94,8 +96,14 @@ if (!process.env.CI) {
chmodSync(".git/hooks/pre-commit", 0o755);
} catch {}

spawn("pnpm", ["rspack", "-w"], {
stdio: "inherit",
cwd: process.cwd(),
const compiler = rspack(rspackConfig);
compiler.watch({}, (err, stats) => {
console.log(
stats.toString({
preset: "minimal",
colors: true,
version: false,
})
);
});
}

0 comments on commit 58d1c01

Please sign in to comment.