Skip to content

Commit 273864f

Browse files
committed
fix dev server
1 parent f4e1b5b commit 273864f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

script/build.mjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ async function build() {
5656
console.timeEnd('build')
5757

5858
if (isWatch) {
59-
const chokidar = require('chokidar')
60-
chokidar.watch('public', { ignoreInitial: true }).on('all', () => {
61-
synchPublic()
59+
import('chokidar').then(async (chokidar) => {
60+
chokidar.watch('public', { ignoreInitial: true }).on('all', () => {
61+
synchPublic()
62+
})
63+
let { host, port } = await ctx.serve({
64+
servedir: 'build'
65+
})
66+
console.log(`Serving to http://${host}:${port}`)
6267
})
63-
let { host, port } = await ctx.serve({
64-
servedir: 'build'
65-
})
66-
console.log(`Serving to http://${host}:${port}`)
6768
} else {
6869
ctx.dispose()
6970
}

0 commit comments

Comments
 (0)