Skip to content

Commit

Permalink
fix(cli): 修正对快应用包名的判断,close #4005
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jul 30, 2019
1 parent d5db7f4 commit 49ab3e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/taro-cli/src/mini/astProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,9 @@ export function parseAst (
value = replaceAliasPath(sourceFilePath, value, pathAlias)
source.value = value
}

const quickappPkgs = quickappManifest ? quickappManifest.features : []
if (isNpmPkg(value) && !isQuickappPkg(value, quickappPkgs) && !notExistNpmList.has(value)) {
if (isNpmPkg(value) && !(isQuickApp && isQuickappPkg(value, quickappPkgs)) && !notExistNpmList.has(value)) {
if (value === taroJsComponents) {
if (isQuickApp) {
specifiers.forEach(specifier => {
Expand Down Expand Up @@ -555,7 +556,7 @@ export function parseAst (
args[0].value = value
}
const quickappPkgs = quickappManifest ? quickappManifest.features : []
if (isNpmPkg(value) && !isQuickappPkg(value, quickappPkgs) && !notExistNpmList.has(value)) {
if (isNpmPkg(value) && !(isQuickApp && isQuickappPkg(value, quickappPkgs)) && !notExistNpmList.has(value)) {
if (value === taroJsComponents) {
if (isQuickApp) {
if (parentNode.declarations.length === 1 && parentNode.declarations[0].init) {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export function copyFiles (appPath: string, copyConfig: ICopyOptions | void) {
}

export function isQuickappPkg (name: string, quickappPkgs: any[] = []): boolean {
const isQuickappPkg = /^@[a-zA-Z]{1,}\.[a-zA-Z]{1,}/.test(name)
const isQuickappPkg = /^@(system|service)\.[a-zA-Z]{1,}/.test(name)
let hasSetInManifest = false
quickappPkgs.forEach(item => {
if (item.name === name.replace(/^@/, '')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/src/util/resolve_npm_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function analyzeImportUrl ({
}) {
if (excludeRequire.indexOf(requirePath) < 0) {
const quickappPkgs = quickappManifest ? quickappManifest.features : []
if (isQuickappPkg(requirePath, quickappPkgs)) {
if (buildAdapter === BUILD_TYPES.QUICKAPP && isQuickappPkg(requirePath, quickappPkgs)) {
return
}
if (isNpmPkg(requirePath)) {
Expand Down

0 comments on commit 49ab3e0

Please sign in to comment.