-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support only output dts #253
Conversation
是什么场景会使得:仅使用 vite 打包 dts,而用其他工具打包 js 代码? |
这是一个需求vue-core |
上面说的 |
examples/ts/vite.config.ts
Outdated
@@ -28,6 +28,7 @@ export default defineConfig({ | |||
staticImport: true, | |||
// insertTypesEntry: true, | |||
rollupTypes: true | |||
// onlyDts:tru |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请删除错误的注释内容
src/plugin.ts
Outdated
@@ -680,6 +681,13 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin { | |||
logger.info( | |||
green(`${logPrefix} Declaration files built in ${timeRecord + Date.now() - startTime}ms.\n`) | |||
) | |||
}, | |||
generateBundle(_: any, bundle: Record<any, any>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请直接让 ts 自行推导类型,无需显式定义类型
src/types.ts
Outdated
/** | ||
* Whether to output only dts | ||
*/ | ||
onlyDts?: boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请更名为 declarationOnly
,并配上更详细的描述,特别要描述该选项会删除所有 vite 打包的原始产物,同时应添加默认值说明。
除此之外,还需要在两个 README 的选项文档中添加相应的内容。
过去输出dts同时会输出其他js产物
现在支持仅输出dts文件