File tree 1 file changed +3
-5
lines changed
packages/vite/src/node/server
1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -172,11 +172,6 @@ async function loadAndTransform(
172
172
let code : string | null = null
173
173
let map : SourceDescription [ 'map' ] = null
174
174
175
- // Ensure that the module is in the graph before it is loaded and the file is checked.
176
- // This prevents errors from occurring during the load process and interrupting the watching process at its inception.
177
- const mod = await moduleGraph . ensureEntryFromUrl ( url , ssr )
178
- ensureWatchedFile ( watcher , mod . file , root )
179
-
180
175
// load
181
176
const loadStart = debugLoad ? performance . now ( ) : 0
182
177
const loadResult = await pluginContainer . load ( id , { ssr } )
@@ -247,6 +242,9 @@ async function loadAndTransform(
247
242
err . code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL
248
243
throw err
249
244
}
245
+ // ensure module in graph after successful load
246
+ const mod = await moduleGraph . ensureEntryFromUrl ( url , ssr )
247
+ ensureWatchedFile ( watcher , mod . file , root )
250
248
251
249
// transform
252
250
const transformStart = debugTransform ? performance . now ( ) : 0
You can’t perform that action at this time.
0 commit comments