From 25f3b6c50b703b7972eaf1b2aca3987a1483c33b Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 26 Dec 2024 01:04:45 +0000 Subject: [PATCH] fix(build): apply resolved tsconfig to dts (#462) --- package.json | 3 ++- src/commands/build.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e249c0..ddeda1e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/commands/build.ts b/src/commands/build.ts index 7b53348..ba0a8bc 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -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' @@ -83,6 +84,8 @@ export default defineCommand({ '@nuxt/kit', '@nuxt/kit-nightly', '@nuxt/kit-edge', + '#app', + '#app/nuxt', 'nuxt', 'nuxt-nightly', 'nuxt-edge', @@ -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]