From 6df0050f938ad2c90469ed259b3777bd192ead93 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 27 Oct 2023 14:40:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(uts):=20=E5=90=8C=E6=AD=A5=20uni=5Fmodules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-cli-shared/lib/uts/uni_modules.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/uni-cli-shared/lib/uts/uni_modules.js b/packages/uni-cli-shared/lib/uts/uni_modules.js index 1c9e64b0d7..47e7fd747d 100644 --- a/packages/uni-cli-shared/lib/uts/uni_modules.js +++ b/packages/uni-cli-shared/lib/uts/uni_modules.js @@ -63,6 +63,9 @@ exports.parseUniExtApis = parseUniExtApis; * @returns */ function parseInjects(vite = true, platform, language, source, uniModuleRootDir, exports = {}) { + if (platform === 'app-plus') { + platform = 'app'; + } let rootDefines = {}; Object.keys(exports).forEach((name) => { if (name.startsWith('uni')) { @@ -71,10 +74,17 @@ function parseInjects(vite = true, platform, language, source, uniModuleRootDir, }); const injects = {}; if (Object.keys(rootDefines).length) { - const hasPlatformFile = uniModuleRootDir + let hasPlatformFile = uniModuleRootDir ? fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'index.uts')) || fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', platform)) : true; + if (!hasPlatformFile) { + if (platform === 'app') { + hasPlatformFile = + fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-android')) || + fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-ios')); + } + } for (const key in rootDefines) { Object.assign(injects, parseInject(vite, platform, language, source, 'uni', rootDefines[key], hasPlatformFile)); } -- GitLab