boolean | PluginDtsOptionstrueModule Federation 生成/消费类型行为配置之后,生产者会在构建时自动生成一个压缩的类型文件 @mf-types.zip(默认名称),消费者会自动拉取 remotes 的类型文件并解压至 @mf-types(默认名称)。
PluginDtsOptions 类型如下:
boolean | DtsRemoteOptionstrueModule Federation 生成类型行为DtsRemoteOptions 类型如下:
当配置 generateTypes 为 true 时,默认会生成下列配置:
booleanundefinedexposes 的内容中有重导出自身的 remotes 模块,那么 extractRemoteTypes: true 能够确保消费者能正常获取生产者 exposes 的模块类型是否抽取 remotes 的类型。
booleanundefinedexposes 的内容中有包含 antd 的模块,并且消费者没装 antd ,那么 extractThirdParty: true 能够确保消费者能正常获取生产者 exposes 的模块类型是否抽取第三方包类型。
booleanundefined是否生成 Federation Runtime 中 loadRemote 类型
booleanundefined是否在子进程中编译生成类型
booleanfalse是否抛出错误当类型生成过程中碰到问题
stringpath.join(process.cwd(),'./tsconfig.json')优先级:dts.generateTypes.tsConfigPath > dts.tsConfigPath
tsconfig 配置文件路径
string'@mf-types'生成的压缩类型文件名称,例如设置了typesFolder为 custom,那么生成的压缩类型文件名称为: custom.zip
booleantrue是否删除生成的类型文件夹
'tsc' | 'vue-tsc''tsc'编译类型的示例
boolean | DtsHostOptionstrueModule Federation 消费(加载)类型行为DtsHostOptions 类型如下:
当配置 consumeTypes 为 true 时,默认会生成下列配置:
booleantrue是否生成运行时 loadRemote API 的类型
number3最大加载失败重试次数
booleanfalse是否抛出错误当类型加载过程中碰到问题
string'@mf-types'加载成功后的的类型存放目录
booleantrue加载类型文件之前,是否删除之前加载的 typesFolder 目录
string'@mf-types'对应 remotes 目录配置的 typesFolder
stringpath.join(process.cwd(),'./tsconfig.json')tsconfig 配置文件路径