File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 99 isDataUrl ,
1010 isParentDirectory ,
1111 transformStableResult ,
12+ tryStatSync ,
1213} from '../utils'
1314import { CLIENT_ENTRY } from '../constants'
1415import { slash } from '../../shared/utils'
@@ -142,8 +143,11 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
142143 const publicPath = '/' + path . posix . relative ( publicDir , file )
143144 builtUrl = await fileToUrl ( this , publicPath )
144145 } else {
145- this . addWatchFile ( file )
146146 builtUrl = await fileToUrl ( this , file )
147+ // during dev, builtUrl may point to a directory or a non-existing file
148+ if ( tryStatSync ( file ) ?. isFile ( ) ) {
149+ this . addWatchFile ( file )
150+ }
147151 }
148152 } catch {
149153 // do nothing, we'll log a warning after this
You can’t perform that action at this time.
0 commit comments