We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
vitejs
Learn more about funding links in repositories.
Report abuse
1 parent 504bc5f commit b6fb323Copy full SHA for b6fb323
packages/vite/src/node/plugins/assetImportMetaUrl.ts
@@ -121,7 +121,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
121
let builtUrl: string | undefined
122
if (file) {
123
try {
124
- if (isParentDirectory(publicDir, file)) {
+ if (publicDir && isParentDirectory(publicDir, file)) {
125
const publicPath = '/' + path.posix.relative(publicDir, file)
126
builtUrl = await fileToUrl(publicPath, config, this)
127
} else {
0 commit comments