fix(vite): normalize full windows paths (#1650)

This commit is contained in:
Daniel Roe 2021-11-02 18:10:56 +00:00 committed by GitHub
parent 37f86a06c1
commit a62351af4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,10 @@ async function transformRequest (opts: TransformOptions, id: string) {
if (id && id.startsWith('/@fs/')) {
// Absolute path
id = id.slice('/@fs'.length)
// On Windows, this may be `/C:/my/path` at this point, in which case we want to remove the `/`
if (id.match(/^\/\w:/)) {
id = id.slice(1)
}
} else if (!id.includes('entry') && id.startsWith('/')) {
// Relative to the root directory
id = '.' + id