In my project we are using NX 19.1.1
, Vite 5.2.12
and TypeScript
.
We have some TypeScript paths defiend in our tsconfig.json
example:
{
"compilerOptions": {
"paths": {
"@components/*": ["src/components/*"]
}
}
}
They work perfectly. (both from VS code stand point, and also after the project is build)
The problem is that when runing the build, in the logs I see a lot of messages like this:
(local build)
app-name: [Nx Vite TsPaths] Unable to resolve @components/common/button with tsconfig paths. Using fallback file matching.
app-name: [Nx Vite TsPaths] Trying to resolve file from config in /app-name/tsconfig.json
app-name: [Nx Vite TsPaths] Resolved @components/common/button to /app-name/src/components/common/button.tsx
When deploying to environment, Jenkins logas are a bit differnent, the last line is:
app-name: [Nx Vite TsPaths] Resolved @components/common/button to /home/ubuntu/workspace/branch_name/src/components/common/button.tsx
All works correct, but the problem is that we have a lot of this logged items in the logs, since every import that uses the path is logging all 3 of this lines. So our logs get more than 200 lines of bloat.
Also my epectation is that if we resolve it, and make it to search in the correct place to begin with, it can speed up the build as well (even is with verry little)
Other things to know:
as explained above, we are using Vite an NX and our vite.config.ts looks something like this:
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
export default defineConfig({
plugins: [react(), nxViteTsPaths()]
})
Best thing willbe if you can help me find what causes the issue and fix it.
Also accepatable, if can disable this type of logging when running the build.