blob: 2e7c2ec309a90accf7eeed643d1111a1c6a219c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
const { createServer } = require('esbuild-server');
const server = createServer(
{
bundle: true,
entryPoints: ['src/index.js', 'src/map.js'],
outdir: 'build'
},
{
static: 'public',
...(process.argv.slice(2).includes('--test')) && {
port: 3005,
injectLiveReload: false,
watch: false
}
}
);
const buildStart = Date.now();
server
.start()
.then(() => {
console.log(`Build completed in ${Date.now() - buildStart}ms`);
})
.catch(() => {
console.error('Build failed');
});
console.log(`Development server running at ${server.url}`);
|