Skip to content

Commit c85dd85

Browse files
committed
feat: use the official virtual prefix \0
Close #608
1 parent 9982223 commit c85dd85

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/core/moduleConstants.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ export const ROUTES_LAST_LOAD_TIME = {
1616
},
1717
}
1818

19-
// using \0 like recommended in docs makes the module not be parsed by vite
20-
// and all of its imports are never refreshed
21-
// having /__ makes the file go through import analysis and adds timestamps to the imports
22-
export const VIRTUAL_PREFIX = '/__'
19+
// we used to have `/__` because HMR didn't work with `\0` virtual modules
20+
// but it seems to work now, so switching to the official Vite virtual module prefix
21+
export const VIRTUAL_PREFIX = '\0'
2322

2423
// allows removing the route block from the code
25-
export const ROUTE_BLOCK_ID = `${VIRTUAL_PREFIX}/vue-router/auto/route-block`
24+
export const ROUTE_BLOCK_ID = asVirtualId('vue-router/auto/route-block')
2625

2726
export function getVirtualId(id: string) {
2827
return id.startsWith(VIRTUAL_PREFIX) ? id.slice(VIRTUAL_PREFIX.length) : null

0 commit comments

Comments
 (0)