Skip to content

Commit 8230208

Browse files
committed
fix: fixed can't found express version
1 parent 1e87665 commit 8230208

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/server/common.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,30 @@ function printInfo(server: Server, vite?: ViteDevServer | null) {
1313
const isAddressInfo = (x: any): x is AddressInfo => x?.address
1414
if (isAddressInfo(address)) {
1515
const ad = cyan(`http://localhost:${bold(address.port)}`)
16-
17-
let msg = `\n express v${require('express/package.json').version}`
18-
if (vite?.config)
19-
msg += ` + vite v${require('vite/package.json').version}`
20-
21-
info(
22-
cyan(msg),
23-
vite?.config ? { clear: !vite.config.logger.hasWarned } : '',
24-
)
25-
26-
info('\n -- SSR mode \n')
27-
28-
info(` > Running at: ${ad}`)
29-
30-
if (vite?.config && vite.config.plugins.find(p => p.name.includes('unocss:inspector')))
31-
info(` > Unocss: ${ad}${cyan('/__unocss')}`)
32-
33-
if (vite?.config && vite.config.plugins.find(p => p.name.includes('vite-plugin-inspect')))
34-
info(` > Inspect: ${ad}${cyan('/__inspect')}`)
35-
36-
const time = Math.round(performance.now() - globalThis.__ssr_ready_time)
37-
info(cyan(`\n ready in ${time}ms.\n`))
16+
try {
17+
let msg = `\n express v${require('express/package.json').version}`
18+
if (vite?.config)
19+
msg += ` + vite v${require('vite/package.json').version}`
20+
21+
info(
22+
cyan(msg),
23+
vite?.config ? { clear: !vite.config.logger.hasWarned } : '',
24+
)
25+
}
26+
finally {
27+
info('\n -- SSR mode \n')
28+
29+
info(` > Running at: ${ad}`)
30+
31+
if (vite?.config && vite.config.plugins.find(p => p.name.includes('unocss:inspector')))
32+
info(` > Unocss: ${ad}${cyan('/__unocss')}`)
33+
34+
if (vite?.config && vite.config.plugins.find(p => p.name.includes('vite-plugin-inspect')))
35+
info(` > Inspect: ${ad}${cyan('/__inspect')}`)
36+
37+
const time = Math.round(performance.now() - globalThis.__ssr_ready_time)
38+
info(cyan(`\n ready in ${time}ms.\n`))
39+
}
3840
}
3941
}
4042

0 commit comments

Comments
 (0)