From fd9a9ee7ba4fd4718dd3c1c6ae807a0543dc0fd5 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 14 Jul 2023 13:48:02 +0100 Subject: [PATCH] feat: `experimental.typescriptBundlerResolution` flag (#1384) Co-authored-by: Pooya Parsa --- src/build.ts | 4 +++- src/types/nitro.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/build.ts b/src/build.ts index 7c1fb56ed4..e26c63070a 100644 --- a/src/build.ts +++ b/src/build.ts @@ -210,7 +210,9 @@ declare module 'nitropack' { strict: nitro.options.typescript.strict, target: "ESNext", module: "ESNext", - moduleResolution: "Node", + moduleResolution: nitro.options.experimental.typescriptBundlerResolution + ? "Bundler" + : "Node", allowJs: true, resolveJsonModule: true, jsx: "preserve", diff --git a/src/types/nitro.ts b/src/types/nitro.ts index abbca85246..b2cbfbb6b6 100644 --- a/src/types/nitro.ts +++ b/src/types/nitro.ts @@ -215,6 +215,10 @@ export interface NitroOptions extends PresetOptions { wasm?: boolean | RollupWasmOptions; legacyExternals?: boolean; openAPI?: boolean; + /** + * See https://github.com/microsoft/TypeScript/pull/51669 + */ + typescriptBundlerResolution?: boolean; }; future: { nativeSWR: boolean;