From 9b279c2e43f90572b757d0cc99c9ab22a97a3836 Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Tue, 9 Apr 2024 02:30:31 -0700 Subject: [PATCH] feat: Add custom tsconfig path resolution (#76) * feat: add manual tsconfig path resolution * chore: fix language in TSDoc * chore: fix CI --- src/build/index.d.ts | 2 ++ src/build/index.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/build/index.d.ts b/src/build/index.d.ts index 927af93..1addb70 100644 --- a/src/build/index.d.ts +++ b/src/build/index.d.ts @@ -9,6 +9,8 @@ export type Options = { exclude?: Array /** Directory where build output will be placed, e.g. `./dist` */ outDir?: string + /** Optional path to a custom tsconfig file, defaults to `./tsconfig.json` */ + tsconfigPath?: string /** Additional dependencies to externalize if not detected by `vite-plugin-externalize-deps` */ externalDeps?: Array } diff --git a/src/build/index.js b/src/build/index.js index 21b1a9f..8946d15 100644 --- a/src/build/index.js +++ b/src/build/index.js @@ -17,12 +17,15 @@ export const tanstackBuildConfig = (options) => { plugins: [ externalizeDeps({ include: options.externalDeps ?? [] }), preserveDirectives(), - tsconfigPaths(), + tsconfigPaths({ + projects: options.tsconfigPath ? [options.tsconfigPath] : undefined, + }), dts({ outDir: `${outDir}/esm`, entryRoot: options.srcDir, include: options.srcDir, exclude: options.exclude, + tsconfigPath: options.tsconfigPath, compilerOptions: { // @ts-expect-error module: 'esnext', @@ -42,6 +45,7 @@ export const tanstackBuildConfig = (options) => { entryRoot: options.srcDir, include: options.srcDir, exclude: options.exclude, + tsconfigPath: options.tsconfigPath, compilerOptions: { // @ts-expect-error module: 'commonjs',