mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
chore: add warning for /
mapping in resolve.alias
(#18588)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
parent
7a33f6fabf
commit
a51c254265
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user