Skip to content

Commit b6fb323

Browse files
authored
fix: check for publicDir before checking if it is a parent directory (#16046)
1 parent 504bc5f commit b6fb323

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/vite/src/node/plugins/assetImportMetaUrl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
121121
let builtUrl: string | undefined
122122
if (file) {
123123
try {
124-
if (isParentDirectory(publicDir, file)) {
124+
if (publicDir && isParentDirectory(publicDir, file)) {
125125
const publicPath = '/' + path.posix.relative(publicDir, file)
126126
builtUrl = await fileToUrl(publicPath, config, this)
127127
} else {

0 commit comments

Comments
 (0)