From 231e7c9611b3afc0076cad0108e2f57efe66b356 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 25 Dec 2024 22:35:31 +0000 Subject: [PATCH] fix(build): apply resolved tsconfig to dts https://github.com/nuxt/module-builder/issues/141 --- package.json | 3 ++- src/commands/build.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e249c0e..ddeda1e0 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 7b533485..ba0a8bca 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]