@@ -7,6 +7,12 @@ const workspaceDir = path.join(projectDir, '../')
77
88const nodeModulesDir = path . join ( workspaceDir , 'node_modules' )
99
10+ // Resolve the single canonical copy of @peculiar /asn1-schema at config load time.
11+ // Multiple nested copies (2.3.8) exist under @credo-ts/core, @peculiar/x509,
12+ // webcrypto-core, and @peculiar/webcrypto. They each get a separate AsnSchemaStorage
13+ // instance causing "Cannot get schema for 'Certificate' target" during mDL validation.
14+ const asn1SchemaEntry = require . resolve ( '@peculiar/asn1-schema' , { paths : [ workspaceDir ] } )
15+
1016const packageDirs = [
1117 fs . realpathSync ( path . join ( nodeModulesDir , '@hyperledger/aries-oca' ) ) ,
1218 fs . realpathSync ( path . join ( nodeModulesDir , '@hyperledger/aries-bifold-core' ) ) ,
@@ -55,7 +61,23 @@ const config = {
5561 resolver : {
5662 unstable_enablePackageExports : true ,
5763 unstable_conditionNames : [ 'react-native' , 'browser' , 'import' , 'require' ] ,
58- blacklistRE : exclusionList ( extraExclusionlist . map ( ( m ) => new RegExp ( `^${ escape ( m ) } \\/.*$` ) ) ) ,
64+ blacklistRE : exclusionList ( [
65+ ...extraExclusionlist . map ( ( m ) => new RegExp ( `^${ escape ( m ) } \\/.*$` ) ) ,
66+ // Block all nested copies of @peculiar /asn1-schema so only the workspace-root
67+ // version (2.3.13) is bundled — prevents split AsnSchemaStorage instances.
68+ new RegExp ( `^${ escape ( path . join ( nodeModulesDir , '@credo-ts/core/node_modules/@peculiar/asn1-schema' ) ) } \\/.*$` ) ,
69+ new RegExp ( `^${ escape ( path . join ( nodeModulesDir , '@peculiar/x509/node_modules/@peculiar/asn1-schema' ) ) } \\/.*$` ) ,
70+ new RegExp ( `^${ escape ( path . join ( nodeModulesDir , 'webcrypto-core/node_modules/@peculiar/asn1-schema' ) ) } \\/.*$` ) ,
71+ new RegExp ( `^${ escape ( path . join ( nodeModulesDir , '@peculiar/webcrypto/node_modules/@peculiar/asn1-schema' ) ) } \\/.*$` ) ,
72+ ] ) ,
73+ resolveRequest : ( context , moduleName , platform ) => {
74+ if ( moduleName === '@peculiar/asn1-schema' ) {
75+ // Directly return the workspace-root version — bypasses Metro's default
76+ // hierarchical node_modules lookup which would find nested copies first.
77+ return { filePath : asn1SchemaEntry , type : 'sourceFile' }
78+ }
79+ return context . resolveRequest ( context , moduleName , platform )
80+ } ,
5981 assetExts : assetExts . filter ( ( ext ) => ext !== 'svg' ) ,
6082 sourceExts : [ ...sourceExts , 'svg' , 'cjs' ] ,
6183 extraNodeModules : {
0 commit comments