Skip to content

Commit bd71e43

Browse files
wusiquankefranabg
authored andcommitted
feat: remove unnecessary check in moduleResolver.ts (#2068)
1 parent c2bd6de commit bd71e43

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Diff for: packages/@vuepress/shared-utils/src/moduleResolver.ts

+10-12
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,17 @@ class ModuleResolver {
212212

213213
if (req.startsWith('@')) {
214214
const pkg = resolveScopePackage(req)
215-
if (pkg) {
216-
// special handling for default org.
217-
if (this.org && pkg.org === this.org) {
218-
shortcut = pkg.name.startsWith(`${this.type}-`)
219-
? pkg.name.slice(this.typePrefixLength)
220-
: pkg.name
221-
name = `${this.scopePrefix}${shortcut}`
222-
} else {
223-
shortcut = this.getShortcut(pkg.name)
224-
name = `@${pkg.org}/${this.nonScopePrefix}${shortcut}`
225-
}
226-
shortcut = `@${pkg.org}/${shortcut}`
215+
// special handling for default org.
216+
if (this.org && pkg.org === this.org) {
217+
shortcut = pkg.name.startsWith(`${this.type}-`)
218+
? pkg.name.slice(this.typePrefixLength)
219+
: pkg.name
220+
name = `${this.scopePrefix}${shortcut}`
221+
} else {
222+
shortcut = this.getShortcut(pkg.name)
223+
name = `@${pkg.org}/${this.nonScopePrefix}${shortcut}`
227224
}
225+
shortcut = `@${pkg.org}/${shortcut}`
228226
} else {
229227
shortcut = this.getShortcut(req)
230228
name = `${this.nonScopePrefix}${shortcut}`

0 commit comments

Comments
 (0)