Skip to content

Commit

Permalink
fix(vite): typecheck infer plugin should use correct inputs (nrwl#27922)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Vite typecheck target is not falling back to default if production does
not exist.
It also does not have an input on typescript itself

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Inputs should be configured correctly

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
  • Loading branch information
Coly010 authored Sep 16, 2024
1 parent dc821ab commit 9c218e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ exports[`@nx/vite/plugin root project should create nodes 1`] = `
"inputs": [
"production",
"^production",
{
"externalDependencies": [
"typescript",
],
},
],
"metadata": {
"description": "Run Typechecking",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ exports[`@nx/vite/plugin with test node root project should create nodes - with
"inputs": [
"production",
"^production",
{
"externalDependencies": [
"typescript",
],
},
],
"metadata": {
"description": "Run Typechecking",
Expand Down
7 changes: 6 additions & 1 deletion packages/vite/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ async function buildViteTargets(
) ?? tsConfigFiles[0];
targets[options.typecheckTargetName] = {
cache: true,
inputs: ['production', '^production'],
inputs: [
...('production' in namedInputs
? ['production', '^production']
: ['default', '^default']),
{ externalDependencies: ['typescript'] },
],
command: `tsc --noEmit -p ${tsConfigToUse}`,
options: { cwd: joinPathFragments(projectRoot) },
metadata: {
Expand Down

0 comments on commit 9c218e7

Please sign in to comment.