Skip to content

Commit

Permalink
fix: avoid removing double slash in fileToUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 27, 2021
1 parent 74b55b8 commit f6db155
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/vite/src/node/plugins/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export function fileToUrl(

function fileToDevUrl(id: string, { root, base }: ResolvedConfig) {
let rtn: string

if (checkPublicFile(id, root)) {
// in public dir, keep the url as-is
rtn = id
Expand All @@ -140,8 +139,7 @@ function fileToDevUrl(id: string, { root, base }: ResolvedConfig) {
// (this is special handled by the serve static middleware
rtn = FS_PREFIX + id
}

return path.posix.join(base, rtn)
return base + rtn.replace(/^\//, '')
}

const assetCache = new WeakMap<ResolvedConfig, Map<string, string>>()
Expand Down

0 comments on commit f6db155

Please sign in to comment.