diff --git a/packages/uni-app-uts/src/plugins/android/uvue/compiler/utils.ts b/packages/uni-app-uts/src/plugins/android/uvue/compiler/utils.ts index dc4d8a3cd9160d771c6c29b7020e96635154615b..1697e67134da021cd63fce784b86c96873cc0c71 100644 --- a/packages/uni-app-uts/src/plugins/android/uvue/compiler/utils.ts +++ b/packages/uni-app-uts/src/plugins/android/uvue/compiler/utils.ts @@ -5,6 +5,7 @@ import { walk } from 'estree-walker' import { parseExpression } from '@babel/parser' import MagicString from 'magic-string' import { + camelize, genUTSComponentPublicInstanceIdent, genUTSComponentPublicInstanceImported, normalizePath, @@ -72,8 +73,21 @@ export function addEasyComponentAutoImports( if (path.isAbsolute(fileName) && fileName.startsWith(rootDir)) { fileName = '@/' + normalizePath(path.relative(rootDir, fileName)) } + + let imported = '' + // 加密插件easycom类型导入 + if (fileName.includes('?uts-proxy')) { + const moduleId = path.basename(fileName.split('?uts-proxy')[0]) + fileName = `uts.sdk.modules.${camelize(moduleId)}` + imported = genUTSComponentPublicInstanceImported( + rootDir, + `@/uni_modules/${moduleId}/components/${tagName}/${tagName}` + ) + } else { + imported = genUTSComponentPublicInstanceImported(rootDir, fileName) + } easyComponentAutoImports[fileName] = [ - genUTSComponentPublicInstanceImported(rootDir, fileName), + imported, genUTSComponentPublicInstanceIdent(tagName), ] }