MCPcopy
hub / github.com/vitejs/vite / onFileChange

Function onFileChange

packages/vite/src/node/server/index.ts:897–911  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

895 }
896
897 const onFileChange = async (file: string) => {
898 file = normalizePath(file)
899 reloadOnTsconfigChange(server, file)
900
901 await Promise.all(
902 Object.values(server.environments).map((environment) =>
903 environment.pluginContainer.watchChange(file, { event: 'update' }),
904 ),
905 )
906 // invalidate module graph cache on file change
907 for (const environment of Object.values(server.environments)) {
908 environment.moduleGraph.onFileChange(file)
909 }
910 await onHMRUpdate('update', file)
911 }
912
913 watcher.on('change', (file) => {
914 onFileChange(file).catch((e) => server.config.logger.error(e))

Callers 1

_createServerFunction · 0.85

Calls 5

normalizePathFunction · 0.90
reloadOnTsconfigChangeFunction · 0.90
onHMRUpdateFunction · 0.85
watchChangeMethod · 0.45
onFileChangeMethod · 0.45

Tested by

no test coverage detected