We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
this.addWatchFile
1 parent 0c488c7 commit d9085f7Copy full SHA for d9085f7
packages/vite/src/node/plugins/loadFallback.ts
@@ -10,10 +10,14 @@ export function loadFallbackPlugin(): Plugin {
10
name: 'vite:load-fallback',
11
async load(id) {
12
try {
13
- // if we don't add `await` here, we couldn't catch the error in readFile
14
- return await fsp.readFile(cleanUrl(id), 'utf-8')
+ const cleanedId = cleanUrl(id)
+ const content = await fsp.readFile(cleanedId, 'utf-8')
15
+ this.addWatchFile(cleanedId)
16
+ return content
17
} catch (e) {
- return fsp.readFile(id, 'utf-8')
18
+ const content = await fsp.readFile(id, 'utf-8')
19
+ this.addWatchFile(id)
20
21
}
22
},
23
0 commit comments