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',