Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build output not written to the correct folder #8865

Open
tylersayshi opened this issue Mar 27, 2025 · 5 comments · May be fixed by #8935
Open

build output not written to the correct folder #8865

tylersayshi opened this issue Mar 27, 2025 · 5 comments · May be fixed by #8935

Comments

@tylersayshi
Copy link
Contributor

Describe the bug

when running pnpm build to double check the output for #8862 I noticed that many files were generated from either tsc or tsup.

Your minimal, reproducible example

n/a

Steps to reproduce

  1. Make any change in packages/query-core to invalidate the nx cache
  2. pnpm build

Expected behavior

From the configs it looks like they should be written to dist-ts, build/modern, or build/legacy. It'd be helpful to get the intended output clarified, but I'm happy to help with another PR for this.

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

System:
OS: macOS 15.3.2
CPU: (8) arm64 Apple M3
Memory: 215.98 MB / 16.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 22.12.0 - ~/.local/state/fnm_multishells/35918_1743092657466/bin/node
pnpm: 9.15.0 - ~/Library/pnpm/pnpm

Tanstack Query adapter

None

TanStack Query version

latest

TypeScript version

No response

Additional context

No response

@TkDodo
Copy link
Collaborator

TkDodo commented Mar 27, 2025

I have no idea why outDir is not respected. It definitely comes from running the compile task, which is a pre-requisite for the build task. It only seems to happen for four packages (query-core, query-devtools, query-persist-client, svelte-query) but not the others 🤷

@tylersayshi
Copy link
Contributor Author

Weird! I can take a look this weekend if it's helpful?

@TkDodo
Copy link
Collaborator

TkDodo commented Mar 27, 2025

yes please 🙏

@tylersayshi
Copy link
Contributor Author

So the first thing I tried was pnpm -F query-core compile and also pnpm -F query-core build. Both of these respect outDir as expected.

So let's move our focus to the top level pnpm build where I first noticed the issue. The top level tsconfig.json has path references, so as a hopeful guess I tried removing query-core from paths (referring to this block: https://github.com/tanstack/query/blob/main/tsconfig.json#L29-L79)... And removing that works! Or at least it results in not having the extra output.

Hopefully you'll know what the proper fix is. The paths used here seem similar to the use-case of project references at first glance to me, but I'll wait to see what you think before suggesting fixes 🙂

@TkDodo
Copy link
Collaborator

TkDodo commented Mar 31, 2025

with paths, navigation in the IDE will go towards the dist output rather than the src. We also use the vite-tsconfig-paths plugin for vitest to resolve imports. I’m not sure why this has an imnpact on build?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants