Skip to content

Commit

Permalink
fix: relative paths without leading dot wasn't rewritten
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Sep 16, 2023
1 parent 9e2ee44 commit 6bea5db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/server/middlewares/indexHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ function shouldPreTransform(url: string, config: ResolvedConfig) {
)
}

const startsWithWordCharRE = /^\w/

const processNodeUrl = (
attr: Token.Attribute,
sourceCodeLocation: Token.Location,
Expand All @@ -118,7 +120,7 @@ const processNodeUrl = (
preTransformRequest(server, fullUrl, devBase)
}
} else if (
url[0] === '.' &&
(url[0] === '.' || startsWithWordCharRE.test(url)) &&
originalUrl &&
originalUrl !== '/' &&
htmlPath === '/index.html'
Expand Down

0 comments on commit 6bea5db

Please sign in to comment.