Skip to content

Commit 7ea51dc

Browse files
committed
fix: type import paths in build
1 parent 8bd990f commit 7ea51dc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

build.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import fs from 'node:fs'
2+
import path from 'node:path'
13
import { defineBuildConfig } from 'unbuild'
24

35
export default defineBuildConfig({
@@ -21,4 +23,13 @@ export default defineBuildConfig({
2123
rollup: {
2224
inlineDependencies: true,
2325
},
26+
hooks: {
27+
// workaround until this gets fixed
28+
// https://github.com/nuxt/module-builder/issues/647
29+
'rollup:done': function (ctx) {
30+
const dts = path.resolve(ctx.options.outDir, 'types.d.mts')
31+
if (fs.existsSync(dts))
32+
fs.cpSync(dts, path.resolve(ctx.options.outDir, 'types.d.ts'))
33+
},
34+
},
2435
})

0 commit comments

Comments
 (0)