Skip to content
Discussion options

You must be logged in to vote

Yes, but not with unplugin-vue. Use two configs: one builds the TS files and leaves the .vue imports alone, and the other only emits declarations for each SFC.

import { defineConfig } from 'tsdown'

export default defineConfig([
  {
    // JS + .d.ts for the TS files; `.vue` imports stay as they are
    entry: ['src/**/*.ts'],
    unbundle: true,
    platform: 'neutral',
    deps: { neverBundle: [/\.vue$/] },
    dts: { vue: true },
    copy: [{ from: 'src/**/*.vue', to: 'dist', flatten: false }],
  },
  {
    // declarations only, one X.vue.d.ts per SFC
    entry: { '*.vue': 'src/**/*.vue' },
    platform: 'neutral',
    dts: { vue: true, emitDtsOnly: true },
  },
])

My test source had s…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@MengLuoRJ
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by MengLuoRJ
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants