Skip to content

Commit

Permalink
fix: check for publicDir before checking if it is a parent directory (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
schelmo committed Mar 11, 2024
1 parent 504bc5f commit b6fb323
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/assetImportMetaUrl.ts
Expand Up @@ -121,7 +121,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
let builtUrl: string | undefined
if (file) {
try {
if (isParentDirectory(publicDir, file)) {
if (publicDir && isParentDirectory(publicDir, file)) {
const publicPath = '/' + path.posix.relative(publicDir, file)
builtUrl = await fileToUrl(publicPath, config, this)
} else {
Expand Down

0 comments on commit b6fb323

Please sign in to comment.