From 6260f9a98d1a7129e3bb164ab085341df7bf3026 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 6 Mar 2023 16:09:50 +0000 Subject: [PATCH] feat: allow customising generated tsconfig path (#1021) --- src/build.ts | 2 +- src/options.ts | 1 + src/types/nitro.ts | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/build.ts b/src/build.ts index edcefbb047..e3f19cef6e 100644 --- a/src/build.ts +++ b/src/build.ts @@ -175,7 +175,7 @@ export async function writeTypes(nitro: Nitro) { ], }; await writeFile( - join(nitro.options.buildDir, "types/tsconfig.json"), + resolve(nitro.options.buildDir, nitro.options.typescript.tsconfigPath), JSON.stringify(tsConfig, null, 2) ); } diff --git a/src/options.ts b/src/options.ts index 03e3c51a5f..0c9a068f83 100644 --- a/src/options.ts +++ b/src/options.ts @@ -87,6 +87,7 @@ const NitroDefaults: NitroConfig = { // Advanced typescript: { generateTsConfig: true, + tsconfigPath: "types/tsconfig.json", internalPaths: false, }, nodeModulesDirs: [], diff --git a/src/types/nitro.ts b/src/types/nitro.ts index 770c00b8cb..116dd85fc1 100644 --- a/src/types/nitro.ts +++ b/src/types/nitro.ts @@ -229,6 +229,8 @@ export interface NitroOptions extends PresetOptions { typescript: { internalPaths?: boolean; generateTsConfig?: boolean; + /** the path of the generated `tsconfig.json`, relative to buildDir */ + tsconfigPath: string; }; hooks: NestedHooks; nodeModulesDirs: string[];