diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index fbfda1452de235..a536058e8e1789 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -806,6 +806,16 @@ function resolveResolveOptions( // resolve alias with internal client alias const alias = normalizeAlias(mergeAlias(clientAlias, resolve?.alias || [])) const preserveSymlinks = resolve?.preserveSymlinks ?? false + + if (alias.some((a) => a.find === '/')) { + logger.warn( + colors.yellow( + `\`resolve.alias\` contains an alias that maps \`/\`. ` + + `This is not recommended as it can cause unexpected behavior when resolving paths.`, + ), + ) + } + return resolveEnvironmentResolveOptions( resolve, alias,