Skip to content

Commit

Permalink
feat: remove unnecessary check in moduleResolver.ts (#2068)
Browse files Browse the repository at this point in the history
  • Loading branch information
wusiquan authored and kefranabg committed Dec 9, 2019
1 parent c2bd6de commit bd71e43
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/@vuepress/shared-utils/src/moduleResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,17 @@ class ModuleResolver {

if (req.startsWith('@')) {
const pkg = resolveScopePackage(req)
if (pkg) {
// special handling for default org.
if (this.org && pkg.org === this.org) {
shortcut = pkg.name.startsWith(`${this.type}-`)
? pkg.name.slice(this.typePrefixLength)
: pkg.name
name = `${this.scopePrefix}${shortcut}`
} else {
shortcut = this.getShortcut(pkg.name)
name = `@${pkg.org}/${this.nonScopePrefix}${shortcut}`
}
shortcut = `@${pkg.org}/${shortcut}`
// special handling for default org.
if (this.org && pkg.org === this.org) {
shortcut = pkg.name.startsWith(`${this.type}-`)
? pkg.name.slice(this.typePrefixLength)
: pkg.name
name = `${this.scopePrefix}${shortcut}`
} else {
shortcut = this.getShortcut(pkg.name)
name = `@${pkg.org}/${this.nonScopePrefix}${shortcut}`
}
shortcut = `@${pkg.org}/${shortcut}`
} else {
shortcut = this.getShortcut(req)
name = `${this.nonScopePrefix}${shortcut}`
Expand Down

0 comments on commit bd71e43

Please sign in to comment.