Skip to content

[cra-template] noEmit always set to true in tsconfig.json regardless of template #11711

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

Open
halfnibble opened this issue Dec 3, 2021 · 7 comments

Comments

@halfnibble
Copy link

It appears that CRA will ignore a cra-template setting for the noEmit value in a tsconfig.json template file.

It does not matter if I leave that field out of the template tsconfig.json file. Or if I explicitly set it to false. The generated template tsconfig file will have noEmit set to true.

Here is my template to repro:
https://github.com/halfnibble/cra-template-heft/

Notice how tsconfig has noEmit: false
https://github.com/halfnibble/cra-template-heft/blob/main/template/tsconfig.json#L21

But that setting will not propagate to projects created with this template.

@halfnibble
Copy link
Author

If I submit a PR making tsconfig's noEmit an overridable default, would someone consider it?

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 8, 2022
@halfnibble
Copy link
Author

This could be considered a duplicate of #10796, but definitely not stale.

@stale stale bot removed the stale label Jan 10, 2022
@faizalkautsar
Copy link

Hey @halfnibble, have you solved this issue? I am in a similar situation now, I have paths value set in my tsconfig file, but the generated template will remove this value.

@halfnibble
Copy link
Author

I have not resolved the issue.
This CRA tool is widely used, but it looks like the maintainers have a lot on their plate.

@faizalkautsar
Copy link

faizalkautsar commented Feb 23, 2022

Looks like it.

Anyway, I have managed to find a workaround for this. My approach includes having custom react-scripts, which is mentioned in CRA official docs.

Basically what I did was altering the compilerOptions variable in packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js to not override paths in the generated tsconfig file.

As for your case, I find the value of noEmit to be { value: true }.

Hope this helps!

@user7564
Copy link

user7564 commented Nov 28, 2022

I have created a PR to try and fix the noEmit issue here: /pull/12868

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

No branches or pull requests

3 participants