Skip to content

Commit

Permalink
fix: don't crash vite when oCIS is not available (#10173)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt authored Dec 14, 2023
1 parent 942bab0 commit e00752a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,16 @@ export default defineConfig(async ({ mode, command }) => {
configureServer(server: ViteDevServer) {
server.middlewares.use(async (request, response, next) => {
if (request.url === '/config.json') {
response.statusCode = 200
response.setHeader('Content-Type', 'application/json')
response.end(JSON.stringify(await getConfigJson(configUrl, config)))
try {
const configJson = await getConfigJson(configUrl, config)
response.statusCode = 200
response.setHeader('Content-Type', 'application/json')
response.end(JSON.stringify(configJson))
} catch (e) {
response.statusCode = 502
response.setHeader('Content-Type', 'application/json')
response.end(JSON.stringify(e))
}
return
}
next()
Expand Down

0 comments on commit e00752a

Please sign in to comment.