Skip to content

Commit

Permalink
fix: resovedUrls is null after server restart
Browse files Browse the repository at this point in the history
  • Loading branch information
XiSenao committed Dec 28, 2023
1 parent 56ae92c commit 291c0a5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/vite/src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,16 @@ export async function _createServer(
_shortcutsOptions: undefined,
}

const reflexServer = new Proxy(server, {
get: (_, property: keyof ViteDevServer) => {
return server[property]
},
set: (_, property: keyof ViteDevServer, value: never) => {
server[property] = value
return true
},
})

if (!middlewareMode) {
exitProcess = async () => {
try {
Expand Down Expand Up @@ -714,7 +724,7 @@ export async function _createServer(
// apply server configuration hooks from plugins
const postHooks: ((() => void) | void)[] = []
for (const hook of config.getSortedPluginHooks('configureServer')) {
postHooks.push(await hook(server))
postHooks.push(await hook(reflexServer))
}

// Internal middlewares ------------------------------------------------------
Expand Down

0 comments on commit 291c0a5

Please sign in to comment.