From a97efec62ca1ca37a3b5314b44f775eac0b162cc Mon Sep 17 00:00:00 2001 From: Payne Fu Date: Sun, 16 Jun 2024 09:47:29 +0800 Subject: [PATCH] udpate main matcher patterns in node modules file sets --- packages/app-builder-lib/src/util/appFileCopier.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/app-builder-lib/src/util/appFileCopier.ts b/packages/app-builder-lib/src/util/appFileCopier.ts index 698ac5fa316..a1fb851561e 100644 --- a/packages/app-builder-lib/src/util/appFileCopier.ts +++ b/packages/app-builder-lib/src/util/appFileCopier.ts @@ -192,7 +192,8 @@ export async function computeNodeModuleFileSets(platformPackager: PlatformPackag for (const info of deps) { const source = info.dir const destination = path.join(mainMatcher.to, NODE_MODULES, info.name) - const matcher = new FileMatcher(platformPackager.info.appDir, destination, mainMatcher.macroExpander, mainMatcher.patterns) + // use main matcher patterns, so, user can exclude some files !node_modules/xxxx + const matcher = new FileMatcher(path.dirname(path.dirname(source)), destination, mainMatcher.macroExpander, mainMatcher.patterns) const copier = new NodeModuleCopyHelper(matcher, platformPackager.info) const files = await copier.collectNodeModules(info, nodeModuleExcludedExts) result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata }) @@ -201,7 +202,7 @@ export async function computeNodeModuleFileSets(platformPackager: PlatformPackag for (const dep of info.conflictDependency) { const source = dep.dir const destination = path.join(mainMatcher.to, NODE_MODULES, info.name, NODE_MODULES, dep.name) - const matcher = new FileMatcher(platformPackager.info.appDir, destination, mainMatcher.macroExpander, mainMatcher.patterns) + const matcher = new FileMatcher(path.dirname(path.dirname(source)), destination, mainMatcher.macroExpander, mainMatcher.patterns) const copier = new NodeModuleCopyHelper(matcher, platformPackager.info) result[index++] = validateFileSet({ src: source, destination, files: await copier.collectNodeModules(dep, nodeModuleExcludedExts), metadata: copier.metadata }) }