Skip to content

Commit

Permalink
fix(build): apply resolved tsconfig to dts (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Dec 26, 2024
1 parent e8cb0ef commit 25f3b6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"unbuild": "^3.0.1"
},
"peerDependencies": {
"nuxi": "^3.17.2"
"nuxi": "^3.17.2",
"typescript": "^5.6.3"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.7.4",
Expand Down
11 changes: 11 additions & 0 deletions src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { NuxtModule } from '@nuxt/schema'
import { findExports, resolvePath } from 'mlly'
import type { ESMExport } from 'mlly'
import { defineCommand } from 'citty'
import { convertCompilerOptionsFromJson } from 'typescript'

import { name, version } from '../../package.json'

Expand Down Expand Up @@ -83,6 +84,8 @@ export default defineCommand({
'@nuxt/kit',
'@nuxt/kit-nightly',
'@nuxt/kit-edge',
'#app',
'#app/nuxt',
'nuxt',
'nuxt-nightly',
'nuxt-edge',
Expand All @@ -97,6 +100,14 @@ export default defineCommand({
})
},
async 'rollup:options'(ctx, options) {
const [entry] = ctx.buildEntries
const mergedCompilerOptions = defu({
noEmit: false,
paths: {
'#app/nuxt': ['./node_modules/nuxt/dist/app/nuxt'],
},
}, ctx.options.rollup.dts.compilerOptions, await loadTSCompilerOptions(entry!.path))
ctx.options.rollup.dts.compilerOptions = convertCompilerOptionsFromJson(mergedCompilerOptions, entry!.path).options
options.plugins ||= []
if (!Array.isArray(options.plugins))
options.plugins = [options.plugins]
Expand Down

0 comments on commit 25f3b6c

Please sign in to comment.