Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-06-04 15:54:18 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-06-04 15:54:18 -0700
commit71f34e930c5164e921e9faa7ef3ab4eda49dcd35 (patch)
treea57a57a7e88123e6068b97060876f94922ee7855 /esbuild-server.mjs
parent7df1eef344de1cb8e66191e59291dd26dc9d7f6b (diff)
Add build start time to server
Diffstat (limited to 'esbuild-server.mjs')
-rw-r--r--esbuild-server.mjs14
1 files changed, 13 insertions, 1 deletions
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}`);