Skip to content

Commit

Permalink
feat: Add custom tsconfig path resolution (#76)
Browse files Browse the repository at this point in the history
* feat: add manual tsconfig path resolution

* chore: fix language in TSDoc

* chore: fix CI
  • Loading branch information
crutchcorn committed Apr 9, 2024
1 parent 218d4a1 commit 9b279c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/build/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type Options = {
exclude?: Array<string>
/** 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<string | RegExp>
}
Expand Down
6 changes: 5 additions & 1 deletion src/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 9b279c2

Please sign in to comment.