Skip to content

Commit

Permalink
fix: skip fileURLToPath when id is not file: protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 22, 2021
1 parent fad4c1e commit c40b810
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/index.mjs
Expand Up @@ -98,7 +98,14 @@ export function resolveImports (code, opts) {
// Utils

export function fileURLToPath (id) {
return _fileURLToPath(id).replace(/\\/g, '/')
if (typeof id === 'string' && !id.startsWith('file://')) {
return normalizeSlash(id)
}
return normalizeSlash(_fileURLToPath(id))
}

function normalizeSlash (str) {
return str.replace(/\\/g, '/')
}

function _pcall (fn, ...args) {
Expand Down

0 comments on commit c40b810

Please sign in to comment.