-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Provide an option to invoke TypeScript in non-watch mode even when webpack is in watch mode #572
Comments
Use simple ts.Program and ts.CompilerHost when running webpack in non-watch mode. This can improve check time in CI for some cases. BREAKING CHANGE: 🧨 Use ts.Program and ts.CompilerHost for single compilation by default ✅ Closes: #572
I will release an alpha version with this implemented - I would like to ask you to test if this solves your issue :) |
Sure, I'll be glad to try that out. Note: it is watch or incremental that causes this issue, so be sure to turn off both. In case you are interested, here is the TypeScript bug: microsoft/TypeScript#35729. I just found out with TS 3.9.7 our project can be built in 20 seconds (regular build, no watch, no incremental)! This means even if we use Also, my initial proposal of the option may not be good. I bet you can come up with something better. |
The solution that I implemented works that way:
For now, there is no configuration for that. If you would like to use |
I think the Program API is what I need, and the whole purpose of the feature request is to enforce it, even when webpack is in watch mode. The reason:
My current workaround is removing |
I found very interesting PR: microsoft/TypeScript#42960. I will publish alpha version anyway, but I will wait for this PR before releasing this on the |
Use simple ts.Program and ts.CompilerHost when running webpack in non-watch mode. This can improve check time in CI for some cases. BREAKING CHANGE: 🧨 Use ts.Program and ts.CompilerHost for single compilation by default ✅ Closes: #572
Yes that was the intent of this PR. I figured that even this that improvement fork-ts-checker-webpack-plugin is a little bit slower compared to |
I will profile the plugin again after releasing your PR :) |
Do you have any idea how "slower" it would be. Currently, with my project, a non-watch build takes 20 seconds. I'm hoping with a proper fix, |
🎉 This issue has been resolved in version 7.0.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I was talking about 10-20%, so it may take 25-30s. But it could also benefit from incremental mode so you only have to pay that on the first compile. It may be worth trying out my typescript PR and check if that fixes your 9min issue. Clone it, |
@piotr-oles I haven't. As we discussed before, the fix I need is to make TypeScript run in non-watch mode, even when webpack is in watch mode. But according to what you described, the alpha version will make TypeScript run in watch mode when webpack is in watch mode. Currently I use I also had some discussion with @sokra in the PR. I believe he made changes to address the specific scenario I described (modify several files and save at the same time). Now we are just waiting for the TypeScript team to incorporate the fix and release TypeScript 4.3. |
That makes sense, let's wait :) |
I will assume it fixed the problem. If not, I will re-open the issue :) |
* feat: use simple program for single compilation (no watch) (#574) Use simple ts.Program and ts.CompilerHost when running webpack in non-watch mode. This can improve check time in CI for some cases. BREAKING CHANGE: 🧨 Use ts.Program and ts.CompilerHost for single compilation by default ✅ Closes: #572 * feat: remove eslint support (#607) BREAKING CHANGE: 🧨 ESLint no longer supported by the plugin * chore: merge main changes (#619) * test: use karton for e2e tests (#627) Use external package to handle e2e tests to simplify code base * feat: drop support for webpack 4 (#638) BREAKING CHANGE: 🧨 Webpack 4 is no longer supported. Please upgrade to Webpack ^5.11.0 or use an older version of the plugin. * feat: improve error formatting to match webpack 4 convention (#641) * feat: upgrade dependencies Upgrade dependencies that doesn't require Node version bump. * chore: remove unused dependencies * feat: drop support for node 10 Node 10 is no longer maintained BREAKING CHANGE: 🧨 Require Node.js >= 12 * chore: upgrade dev dependencies * feat: remove support for TypeScript < 3.6.0 (#643) BREAKING CHANGE: 🧨 Drop support for TypeScript < 3.6.0 * feat: port changes from main branch (#649) This commit contains fixes from the main branch * fix: require typescript@^3.8.0 for build: true mode (#672) SolutionBuilder API is buggy for TypeScript < 3.8.0. To reduce maintenance burden, we bump minimal TypeScript version for { build: true } mode to 3.8.0. BREAKING CHANGE: 🧨 Minimal version of TypeScript with { build: true } mode changed from 3.6.0 to 3.8.0 * refactor: add eslint rules to enforce import order (#671) * feat: migrate from reporters to workers (#691) Use simple functions and modules to simplify worker code * refactor: rename files to match convention (#693) I found snake-case easier to read, and given that the project doesn't use OOP a lot, having all PascalCase names doesn't reflect the paradigm and feels unnatural. * feat: simplify logger options (#695) Currently, the logger options are overcomplicated. To simplify them, we are removing logger.infrastructure option. BREAKING CHANGE: 🧨 Changes in options: `logger.issues` becomes `logger`, `logger.devServer` becomes `devServer`, `logger.infrastructure` has been removed * docs: add plugin logo (#696) * refactor: upgrade project dependencies (#698)
🎉 This issue has been resolved in version 7.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Feature motivation
TypeScript has some strange behavior that regular build is much faster a watch-mode build (sometimes the watch-mode build is 30x slower). This slows down forked type checking significantly.
Feature description
Provide an option to always invoke TypeScript in non-watch mode. This will make type checking time much more consistent and often shorter.
For example, with my project,
tsc
(complete build) is consistently completed within 60 seconds.tsc -w
initial compilation takes about 9 minutes. Subsequent recompilation in watch mode time ranges from 1 second to several minutes. Even worse, if I change another file while type checking is still running, the webpack bundling process will be slowed down too.Feature implementation
watch
:"auto"
(follows webpack) or"off"
The text was updated successfully, but these errors were encountered: