From 8d0cd9e82a0f403cd68f32851fc4ae1e3ee45a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=98=9F=28666595=29?= <666595@nd.com.cn> Date: Fri, 9 Aug 2019 20:14:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(cli):=20=E5=BE=AA=E7=8E=AF=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E6=94=AF=E6=8C=81alias=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/util/resolve_npm_files.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/taro-cli/src/util/resolve_npm_files.ts b/packages/taro-cli/src/util/resolve_npm_files.ts index 928924db646c..9ceec4176e9e 100644 --- a/packages/taro-cli/src/util/resolve_npm_files.ts +++ b/packages/taro-cli/src/util/resolve_npm_files.ts @@ -36,6 +36,8 @@ import { import defaultUglifyConfig from '../config/uglify' import * as npmProcess from './npm' +import * as Util from '../util' +import { getBuildData } from '../mini/helper' import { IInstallOptions, INpmConfig, IResolvedCache, TogglableOptions, ITaroManifestConfig } from './types' const excludeNpmPkgs = ['ReactPropTypes'] @@ -153,6 +155,11 @@ function analyzeImportUrl ({ babelConfig: object, quickappManifest?: ITaroManifestConfig }) { + // alias 替换 + const { alias } = getBuildData() + if (Util.isAliasPath(requirePath, alias)) { + requirePath = Util.replaceAliasPath(filePath, requirePath, alias) + } if (excludeRequire.indexOf(requirePath) < 0) { const quickappPkgs = quickappManifest ? quickappManifest.features : [] if (buildAdapter === BUILD_TYPES.QUICKAPP && isQuickappPkg(requirePath, quickappPkgs)) {