Skip to content

Commit

Permalink
fix(resolve): resolve absolute paths as-is
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Oct 27, 2021
1 parent 0504ad8 commit c6e4f9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -25,12 +25,13 @@
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "latest",
"@types/node": "latest",
"import-meta-resolve": "^1.1.1",
"chai": "^4.3.4",
"eslint": "latest",
"import-meta-resolve": "^1.1.1",
"jiti": "^1.12.5",
"mocha": "^9.1.2",
"standard-version": "latest",
"unbuild": "^0.5.7"
"unbuild": "^0.5.7",
"pathe": "^0.2.0"
}
}
6 changes: 6 additions & 0 deletions src/resolve.ts
@@ -1,5 +1,6 @@
import { realpathSync } from 'fs'
import { pathToFileURL } from 'url'
import { isAbsolute } from 'pathe'
import { moduleResolve } from 'import-meta-resolve'
import { fileURLToPath, normalizeid } from './utils'
import { pcall, BUILTIN_MODULES } from './_utils'
Expand Down Expand Up @@ -37,6 +38,11 @@ function _resolve (id: string, opts: ResolveOptions = {}): string {
return 'node:' + id
}

// Skip absolute
if (isAbsolute(id)) {
return id
}

// Condition set
const conditionsSet = opts.conditions ? new Set(opts.conditions) : DEFAULT_CONDITIONS_SET

Expand Down

0 comments on commit c6e4f9f

Please sign in to comment.