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 9
9
isDataUrl ,
10
10
isParentDirectory ,
11
11
transformStableResult ,
12
+ tryStatSync ,
12
13
} from '../utils'
13
14
import { CLIENT_ENTRY } from '../constants'
14
15
import { slash } from '../../shared/utils'
@@ -142,8 +143,11 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
142
143
const publicPath = '/' + path . posix . relative ( publicDir , file )
143
144
builtUrl = await fileToUrl ( this , publicPath )
144
145
} else {
145
- this . addWatchFile ( file )
146
146
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
+ }
147
151
}
148
152
} catch {
149
153
// do nothing, we'll log a warning after this
You can’t perform that action at this time.
0 commit comments