Skip to content

Commit

Permalink
fix(vite): get tsconfig from new path including target (#22775)
Browse files Browse the repository at this point in the history
## Current Behavior
Since v18.2.3 (e4c4697) the
`tsconfig.generated.json` file generated if `"buildLibsFromSource":
false` is placed under a path containing the current build target. The
`nx-tsconfig-paths` plugin of `@nx/vite` was not updated accordingly, so
now it doesn't find `tsconfig.generated.json`, effectively causing
`@nx/vite` to ignore the `"buildLibsFromSource": false` setting.

## Expected Behavior
With this PR, `nx-tsconfig-paths` finds `tsconfig.generated.json` at the
correct path, so `"buildLibsFromSource": false` works as it did before
v18.2.3.

(cherry picked from commit b4f6e42)
  • Loading branch information
ms-tng authored and FrozenPandaz committed May 9, 2024
1 parent 6106424 commit 8ba5570
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion e2e/vite/src/vite-legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default App;
const results = runCLI(`build ${app} --buildLibsFromSource=false`);
expect(results).toContain('Successfully ran target build for project');
// this should be less modules than building from source
expect(results).toContain('40 modules transformed');
expect(results).toContain('38 modules transformed');
});

it('should build app from libs without package.json in lib', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/vite/plugins/nx-tsconfig-paths.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function nxViteTsPaths(options: nxViteTsPathsOptions = {}) {
workspaceRoot,
'tmp',
projectRootFromWorkspaceRoot,
process.env.NX_TASK_TARGET_TARGET ?? 'build',
'tsconfig.generated.json'
)
);
Expand Down

0 comments on commit 8ba5570

Please sign in to comment.