Add build start time to server

This commit is contained in:
Catalin Constantin Mititiuc 2024-06-04 15:54:18 -07:00
parent 7df1eef344
commit 71f34e930c

View File

@ -154,7 +154,11 @@ const svgUseCacheBust = {
const resolveSvgImports = { const resolveSvgImports = {
name: 'resolveSvgImports', name: 'resolveSvgImports',
setup(build) { setup(build) {
let buildStart;
build.onStart(() => { build.onStart(() => {
buildStart = Date.now();
console.log('Build started');
fs.rmSync(path.resolve(build.initialOptions.outdir), { recursive: true, force: true }); fs.rmSync(path.resolve(build.initialOptions.outdir), { recursive: true, force: true });
}); });
@ -163,6 +167,10 @@ const resolveSvgImports = {
path: path.resolve('public', args.path), 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 }); 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}`);