File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
packages/vite/src/node/server Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -172,11 +172,6 @@ async function loadAndTransform(
172172 let code : string | null = null
173173 let map : SourceDescription [ 'map' ] = null
174174
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-
180175 // load
181176 const loadStart = debugLoad ? performance . now ( ) : 0
182177 const loadResult = await pluginContainer . load ( id , { ssr } )
@@ -247,6 +242,9 @@ async function loadAndTransform(
247242 err . code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL
248243 throw err
249244 }
245+ // ensure module in graph after successful load
246+ const mod = await moduleGraph . ensureEntryFromUrl ( url , ssr )
247+ ensureWatchedFile ( watcher , mod . file , root )
250248
251249 // transform
252250 const transformStart = debugTransform ? performance . now ( ) : 0
You can’t perform that action at this time.
0 commit comments