From 71f34e930c5164e921e9faa7ef3ab4eda49dcd35 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Tue, 4 Jun 2024 15:54:18 -0700
Subject: Add build start time to server
---
esbuild-server.mjs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/esbuild-server.mjs b/esbuild-server.mjs
index 2421f23..906ff63 100644
--- a/esbuild-server.mjs
+++ b/esbuild-server.mjs
@@ -154,7 +154,11 @@ const svgUseCacheBust = {
const resolveSvgImports = {
name: 'resolveSvgImports',
setup(build) {
+ let buildStart;
+
build.onStart(() => {
+ buildStart = Date.now();
+ console.log('Build started');
fs.rmSync(path.resolve(build.initialOptions.outdir), { recursive: true, force: true });
});
@@ -163,6 +167,10 @@ const resolveSvgImports = {
path: path.resolve('public', args.path),
};
});
+
+ build.onEnd(() => {
+ console.log(`Build completed in ${Date.now() - buildStart}ms`);
+ });
}
}
@@ -283,4 +291,8 @@ http.createServer((req, res) => {
req.pipe(proxyReq, { end: true });
}
-}).listen(8080);
+}).listen(8080, (e) => {
+ console.log('server is online', e);
+});
+
+// console.log(`${process.env.NODE_ENV === 'test' ? 'Test' : 'Development'} server running at ${server.url}`);
--
cgit v1.2.3