模块系统的核心配置接口。
Record<string, string>
Record<string, string>
ModuleConfigExportExports
导出配置的联合类型,支持混合数组(字符串和对象)、对象两种形式。
string
Record<BuildSsrTarget, string | false>
boolean
true
构建目标环境类型。
在 exports
数组形式的字符串项中支持以下前缀:
'npm:packageName'
rewrite: false
,保持原始导入路径'npm:axios'
→ { input: 'axios', rewrite: false }
'root:path/to/file.ext'
rewrite: true
,去除文件扩展名,添加 ./
前缀'root:src/utils/format.ts'
→ { input: './src/utils/format', rewrite: true }
框架自动为每个模块添加以下默认导出项: