Skip to content

Commit

Permalink
fix(resolver): fix fileToReqest reverse alias check
Browse files Browse the repository at this point in the history
fix #435
  • Loading branch information
yyx990803 committed Jun 23, 2020
1 parent b31e56a commit 1a3730a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { hmrClientPublicPath } from './server/serverPluginHmr'
import chalk from 'chalk'

const debug = require('debug')('vite:resolve')
const isWin = require('os').platform() === 'win32'
const pathSeparator = isWin ? '\\' : '/'

export interface Resolver {
requestToFile?(publicPath: string, root: string): string | undefined
Expand Down Expand Up @@ -143,7 +145,7 @@ export function createResolver(
}
},
fileToRequest(filePath) {
if (filePath.startsWith(target + path.delimiter)) {
if (filePath.startsWith(target + pathSeparator)) {
return slash(key + path.relative(target, filePath))
}
}
Expand Down

0 comments on commit 1a3730a

Please sign in to comment.