fix watch building

This commit is contained in:
Percs 2024-07-13 17:38:08 -05:00
parent 5c8582bf88
commit 6c2d542d3e

View file

@ -5,8 +5,8 @@ import Fastify from "fastify";
import fastifyStatic from "@fastify/static"; import fastifyStatic from "@fastify/static";
import { join } from "node:path"; import { join } from "node:path";
import fs from "node:fs" import fs from "node:fs"
import { spawn } from "node:child_process"
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { watch } from "rollup"
import { loadConfigFile } from "rollup/loadConfigFile" import { loadConfigFile } from "rollup/loadConfigFile"
//transports //transports
@ -69,4 +69,14 @@ fastify.register(fastifyStatic, {
}) })
fastify.listen({ fastify.listen({
port: process.env.PORT || 1337 port: process.env.PORT || 1337
});
const watch = spawn("rollup", ["-c", "-w"], { detached: true });
watch.stdout.on("data", (data) => {
console.log(`${data}`);
});
watch.stderr.on("data", (data) => {
console.log(`${data}`);
}); });