Closed dBianchii closed 3 months ago
I think You have to delete the tsbuildinfo
I think You have to delete the tsbuildinfo
Even after deleting it inside node_modules/.cache/tsbuildinfo.json, this won't work.
I only managed to make it build again and output the dist folder, after deleting both packages/api/node_modules/.cache/tsbuildinfo.json
and after deleting the root node_modules/.cache
folder.
Had the same behavior. Tried it with pnpm clean:workspaces
+ deleting the /.turbo
directory.
Sometimes it worked... sometimes not.
Workaround is currently to use an alternative compiler/bundler. But not sure if this works for all use cases.
Currently I use tsup
, but pkgroll
or something else should work, too.
System:
OS: macOS 14.5
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Memory: 18.86 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.1.0 - ~/.nvm/versions/node/v22.1.0/bin/node
Yarn: 3.5.1 - /usr/local/bin/yarn
npm: 10.7.0 - ~/.nvm/versions/node/v22.1.0/bin/npm
pnpm: 9.2.0 - ~/Library/pnpm/pnpm
Turbo version is 2.0.3
@dBianchii i spent some time at stackoverflow and found the following: https://stackoverflow.com/questions/59055799/tsc-not-creating-the-dist-folder
Updated my build
command to
"build": "rimraf dist/ && rimraf node_modules/.cache/tsbuildinfo.json && tsc --noEmit false --outDir dist",
and it seems to work
Here the relevant tsconfig
s
// /apps/backend/tsconfig.json
{
"extends": "@acme/tsconfig/base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["."],
"exclude": ["node_modules", "dist"]
}
// /tooling/typescript/base.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ES2022",
"lib": ["ES2022"],
"allowJs": true,
"resolveJsonModule": true,
"moduleDetection": "force",
"isolatedModules": true,
"incremental": true,
"disableSourceOfProjectReferenceRedirect": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"checkJs": true,
"module": "Preserve",
"moduleResolution": "Bundler",
"noEmit": true
},
"exclude": ["node_modules", "build", "dist", ".next", ".expo"]
}
Hi,
short update: I'm currently evaluating the usage of "tsx" in prod via
node --import tsx src/index.ts
The node
command is called in the Dockerfile of my app.
With this call I don't have to call tsc
or tsup
can export always the ts files ( and there are no dev/build scripts inside the packages - if not needed (e.g. to generate the locale files) )
Why? Maybe it was just a misconfiguration on my side, but with the compiled files it got some errors while running vitest. If I fixed these issues, then the build failed... it's annoying and to make it work, I decided to switch to another approach.
Should we do it? Yes, no, maybe.
There is a gh issue where they did a quick benchmark. https://github.com/TypeStrong/ts-node/issues/104#issuecomment-1941702624
I added "tsx" as dependency
and everything seems to work as expected.
Have to test it in our K8S environment to see if we will get some memory/performance issues.
I only managed to make it build again and output the dist folder, after deleting both
packages/api/node_modules/.cache/tsbuildinfo.json
and after deleting the rootnode_modules/.cache
folder.
I don't think you have to delete the root one, just the one for the task you wanna bust the cache for. I don't know if typescript is able to restore the output or if it just uses the cache for incremental builds. Do you get a different behavior in a more minimal reproduction environment?
I only managed to make it build again and output the dist folder, after deleting both
packages/api/node_modules/.cache/tsbuildinfo.json
and after deleting the rootnode_modules/.cache
folder.I don't think you have to delete the root one, just the one for the task you wanna bust the cache for. I don't know if typescript is able to restore the output or if it just uses the cache for incremental builds. Do you get a different behavior in a more minimal reproduction environment?
I am using exactly stock and up to date create-t3-turbo. I just confirmed now that even after I delete only packages/api/node_modules/.cache
folder and run pnpm build -F @acme/api
, FULL TURBO will still appear and no dist folder appears.
Fixed by https://github.com/t3-oss/create-t3-turbo/pull/1140!! :tada:
Thank you @juliusmarminge
Provide environment information
System: OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa) CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-11390H @ 3.40GHz Memory: 3.94 GB / 15.36 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node Yarn: 1.22.21 - ~/.local/share/pnpm/yarn npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm pnpm: 9.0.4 - ~/.local/share/pnpm/pnpm bun: 1.1.3 - ~/.bun/bin/bun
Describe the bug
After deleting the either compiled
dist
folder in eitherpackages/db
orpackages/api
, when you call pnpm build for that directory once again, it seems that turbo is caching the result and not outputing thedist
folder once again.Link to reproduction
I mean... this repo?
To reproduce
pnpm i
on a clean repo (after doingpnpm clean:workspaces
)pnpm build -F api
orpnpm build -F db
.pnpm build -F api
Additional information
https://www.loom.com/share/87c7ac25faa242c8888217927fd11c0d?sid=2487cce1-ae7a-414e-a30b-8dcb69845db0