Skip to content

feat(webpack): support tsconfig.app.json when present #10221

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

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

rigor789
Copy link
Member

PR Checklist

What is the current behavior?

Only Angular projects support tsconfig.app.json.

What is the new behavior?

Any project using typescript will use the tsconfig.app.json if it exists (and fall back to tsconfig.json otherwise).

Motivation behind this change

It's common to have different tsconfigs to provide different types for VSCode intellisense, however sometimes these config changes should only apply to VSCode (or any editor) and not the app itself. In these cases this change allows setting editor defaults in tsconfig.json and then app defaults in tsconfig.app.json.

A good example where this might be useful is when you need to have intellisense in spec files by having a tsconfig.spec.json which needs to be referenced in tsconfig.json (solution-style tsconfig), however the app itself fails to compile with solution style configuration, so it needs a tsconfig.app.json that is not solution-style.

Alternative

The same can be achieved in user-config:

config.module.rule('ts').use('ts-loader').tap(options => {
  options.configFile = 'tsconfig.app.json'
  return options
})

config.plugin('ForkTsCheckerWebpackPlugin').tap(args => {
  args[0].typescript.configFile = 'tsconfig.app.json'
  return args
})

@nx-cloud
Copy link

nx-cloud bot commented Feb 24, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 61ae59f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@cla-bot cla-bot bot added the cla: yes label Feb 24, 2023
@rigor789 rigor789 marked this pull request as ready for review March 28, 2023 13:34
@rigor789 rigor789 merged commit ebb827f into main Mar 28, 2023
@rigor789 rigor789 deleted the feat/webpack-tsconfig.app.json-support branch March 28, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant