Skip to content
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

configOverride ignored when build: true #734

Open
whamtet opened this issue Apr 15, 2022 · 5 comments
Open

configOverride ignored when build: true #734

whamtet opened this issue Apr 15, 2022 · 5 comments
Labels

Comments

@whamtet
Copy link
Contributor

whamtet commented Apr 15, 2022

Current behavior

configOverride ignored when build:true

Expected behavior

configOverride should either work when build:true or the documentation should more clearly explain why not. Happy to submit a PR for either case once this is clarified. You accepted a documentation PR from me the other day.

Steps to reproduce the issue

Clone the below repo. Try running npm start with build in webpack.config.js set to both true and false. When build: false the plugin correctly detects the configOverride and does incremental compilation.

Issue reproduction repository

https://github.com/whamtet/template-ts-webpack

Environment

  • fork-ts-checker-webpack-plugin: 7.2.6
  • typescript: 4.6.3
  • eslint: n/a
  • webpack: 5.72.0
  • os: OSX 11.6.3 Intel CPU
@whamtet whamtet added the bug label Apr 15, 2022
@piotr-oles
Copy link
Collaborator

Hi! 👋🏻 Thanks for the report. There is no explicit logic that disables config overwrite for build: true, but I guess this is probably related to project references 🤔 When you have build: true, it creates multiple typescript projects, each with its own configuration. I think we overwrite only the entry one (but maybe even this doesn't work? I'm not sure how typescript is handling this).
My point is that it's hard to define how configOverwrite should behave in the case where we have multiple tsconfg.json files. Personally, I would expect that this overwrites only the entry config file, but I guess there are some use-cases, where overwriting all config files would be desired behaviour.
What do you think? What behaviour do you expect?

@whamtet
Copy link
Contributor Author

whamtet commented Apr 15, 2022 via email

@whamtet
Copy link
Contributor Author

whamtet commented Apr 22, 2022

Any more thoughts @piotr-oles ? To help solve this issue I need to understand the design intent points 1) and 2) above

@piotr-oles
Copy link
Collaborator

should I have to set write-references: true to get it to spit out tsBuildInfoFile?

According to TypeScript docs, it should be possible to spit out tsbuildinfo with incremental: true mode, which does not need build: true. I don't think it's currently supported in the plugin 🤔
There is a separate API to create incremental program, so I'm not sure if WatchProgram supports incremental: true. You can try it out, and see if it's possible to emit .tsbuildinfo without build: true (but with incremental: true in the tsconfig.json). Here is file that contains some interesting conditions regarding .tsbuildinfo emit: https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/src/typescript/worker/lib/tsbuildinfo.ts
And it looks like we try to emit this in the WatchProgram: https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/src/typescript/worker/lib/program/watch-program.ts#L54

@wootencl
Copy link

wootencl commented Aug 10, 2022

I'll mention I'm seeing this in an nx monorepo as well and suspect its for the the reasons mentioned: multi config files/projects throughout the repo. Not a huge deal but figured I'd call it out as another data point.

Aside, it would be nice if it could override a multi project setup but understandably maybe not worth the investment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants