Skip to content

Commit

Permalink
fix: strip "public/" prefix in defaultFileToRequest (vitejs#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson authored Aug 30, 2020
1 parent 0455b91 commit 5d98994
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/node/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,9 @@ const defaultRequestToFile = (publicPath: string, root: string): string => {
return path.join(root, publicPath.slice(1))
}

const defaultFileToRequest = (filePath: string, root: string): string => {
const moduleRequest = moduleFileToIdMap.get(filePath)
if (moduleRequest) {
return moduleRequest
}
return `/${slash(path.relative(root, filePath))}`
}
const defaultFileToRequest = (filePath: string, root: string): string =>
moduleFileToIdMap.get(filePath) ||
'/' + slash(path.relative(root, filePath)).replace(/^public\//, '')

const isFile = (file: string): boolean => {
try {
Expand Down

0 comments on commit 5d98994

Please sign in to comment.