Skip to content

Commit e571eb4

Browse files
committed
feat(mkdist): emit .d.vue.ts as type declaration of .vue files
1 parent b67a3d6 commit e571eb4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/plugins/mkdist.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,22 @@ export const vueLoader: Loader = async (input, mkdistContext) => {
7171
})
7272

7373
// generate dts
74-
const dts = (await mkdistContext.loadFile({
75-
path: `${input.path}.js`,
76-
srcPath: `${input.srcPath}.js`,
77-
extension: '.js',
78-
getContents: () => 'export default {}',
79-
}))?.filter(f => f.declaration) || []
74+
const dts = [
75+
{
76+
contents: 'export default {}',
77+
path: `${input.path}.js`,
78+
srcPath: `${input.srcPath}.js`,
79+
extension: '.d.ts',
80+
declaration: true,
81+
},
82+
{
83+
contents: await input.getContents(),
84+
path: input.path,
85+
srcPath: input.srcPath,
86+
extension: '.d.vue.ts',
87+
declaration: true,
88+
},
89+
]
8090

8191
return [
8292
{

0 commit comments

Comments
 (0)