Skip to content

Commit

Permalink
feat: Add custom tsconfig path resolution (TanStack#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
Rate limit · GitHub

Whoa there!

You have triggered an abuse detection mechanism.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

crutchcorn authored Apr 9, 2024
1 parent 218d4a1 commit 9b279c2
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
@@ -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>
}
6 changes: 5 additions & 1 deletion src/build/index.js
Original file line number Diff line number Diff line change
@@ -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',

0 comments on commit 9b279c2

Please sign in to comment.