-
Notifications
You must be signed in to change notification settings - Fork 12k
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
ng serve: compile time 10x slower with tailwind 2.2.x #21228
Comments
The first thing I noticed is that there are a large number of Sass compilations which take around 16.4s. From some debugging I noticed that tailwind is adding a virtual directory
This has a dependency on all the component stylesheets.
This directory is being invalidated with on every change which cause all components to be invalidated and recompiled. |
@alan-agius4 Let me know if you need something else from me |
Just ran into this problem myself. So in case you were wondering, it isn't just you. I'll be reverting to the older tailwindcss for now, I think. |
@karptonite, are you using Angular CLI 11 as well? If so, can you please update to the latest version and try again? I tried to replicate this issue using the latest version of tailwindcss, webpack and Angular CLI and I am unable. Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases. Please update to the most recent version to resolve the problem. |
I am on Angular CLI 11. If this is fixed in 12, that is great, and I can give it a try once our other dependencies are updated for Angular 12. Do you happen to know if it was fixed in the CLI 11 branch later than 11.2.10? |
If this is indeed fix, my assumption would be that it was fixed as part of the Webpack 5 implementation. Hence, I doubt that it was fixed in 11.2.x. It would be great if someone can confirm that the issue is no longer present in version 12. |
Just tested our app with Times on Angular v12 are faster than v11 but still considerably longer with the lower version of tailwindcss. ~3seconds vs ~30seconds between each save. Here the cpu profiles recorded of the 2 tailwind versions with Angular v12.1.0 - TailwindCSS v.2.1.2Angular v12.1.0 - TailwindCSS v.2.2.4Recorded CPU profiles Hope this helps @alan-agius4 |
Hi @gianmd, Can you try to add the below in for (const changedFile of [...compiler.modifiedFiles, ...compiler.removedFiles]) {
+ if (!require('path').extname(changedFile)) {
+ continue;
+ }
const normalizedChangedFile = paths_1.normalizePath(changedFile);
// Invalidate file dependencies
this.fileDependencies.delete(normalizedChangedFile);
// Invalidate existing cache
cache.invalidate(normalizedChangedFile);
changedFiles.add(normalizedChangedFile);
} |
Hi @alan-agius4
|
Can you try to provide a minimal reproduction? I am having some trouble replicating this behaviour with version 12. I’ll try to continue looking at the profiles maybe I spot something. |
@alan-agius4 I was able to recreate a minimal reproduction on a fresh angular project. You can clone the repo here https://github.com/gianmd/tailwindcss-angular12-replica
You can compare compiling times with Bellow the result of the tests with this reproduction repo
Profiles files |
@gianmd thanks for the repro, I’ll look into it, in the next couple of days. |
`fileDependencies` can contain directories and not just files which can cause incorrect cache invalidation on rebuilds. Example ``` '/Users/***/tailwindcss-angular12-replica/src/app/component19/component19.component.scss', '/Users/***/tailwindcss-angular12-replica/tailwind.config.js', '/var/folders/mp/zsgl3srd389_js72bk4_bkgh0000gn/T/tmp-19814-FDsnpPo5zlQK', '/Users/***/tailwindcss-angular12-replica/package.json', '/Users/***/tailwindcss-angular12-replica/src/app/component19', '/Users/***/tailwindcss-angular12-replica/src/app', '/Users/***/tailwindcss-angular12-replica/src', '/Users/***/tailwindcss-angular12-replica', '/Users/***', '/Users/****', '/Users', '/' ``` Closes #21228 (cherry picked from commit dbbcf5c)
`fileDependencies` can contain directories and not just files which can cause incorrect cache invalidation on rebuilds. Example ``` '/Users/***/tailwindcss-angular12-replica/src/app/component19/component19.component.scss', '/Users/***/tailwindcss-angular12-replica/tailwind.config.js', '/var/folders/mp/zsgl3srd389_js72bk4_bkgh0000gn/T/tmp-19814-FDsnpPo5zlQK', '/Users/***/tailwindcss-angular12-replica/package.json', '/Users/***/tailwindcss-angular12-replica/src/app/component19', '/Users/***/tailwindcss-angular12-replica/src/app', '/Users/***/tailwindcss-angular12-replica/src', '/Users/***/tailwindcss-angular12-replica', '/Users/***', '/Users/****', '/Users', '/' ``` Closes #21228
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
`fileDependencies` can contain directories and not just files which can cause incorrect cache invalidation on rebuilds. Example ``` '/Users/***/tailwindcss-angular12-replica/src/app/component19/component19.component.scss', '/Users/***/tailwindcss-angular12-replica/tailwind.config.js', '/var/folders/mp/zsgl3srd389_js72bk4_bkgh0000gn/T/tmp-19814-FDsnpPo5zlQK', '/Users/***/tailwindcss-angular12-replica/package.json', '/Users/***/tailwindcss-angular12-replica/src/app/component19', '/Users/***/tailwindcss-angular12-replica/src/app', '/Users/***/tailwindcss-angular12-replica/src', '/Users/***/tailwindcss-angular12-replica', '/Users/***', '/Users/****', '/Users', '/' ``` Closes angular#21228
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Problematic Angular-cli version:
^11.2.10
Previous TailwindCSS version with no problem:
[email protected]
Problematic Version:
[email protected]
Description
Since Angular-cli
v11.2
started supporting TailwindCSS natively, we decided to upgrade our codebase to use TailwindCSS instead of custom css on the most part of our app.We use tailwindCSS with JIT mode enabled, and we haven't had any problems until now.
Recently TailwindCSS upgraded to version
2.2.4
and bringing more features, and a New dependency tracking system for Just-in-Time mode. The latest tracking system dependency is compatible with webpack 4 and webpack 5 (using the latestpostcss-loader@^4
andpostcss-loader@^5
), So we decided to upgrade to this version and now we are experiencing x10 compilation times.Our application is quite large and typically experience ~5 incremental compile times with
ng serve
. With the new version of[email protected]
this compiling times are now ~65seconds on each save.🔬 Minimal Reproduction
Since our app is large, it is hard to replicate the problem on a new repo. I'm attaching the CPU Profiles comparing the 2 tailwindCSS versions.
CPU Profiles ZIP
CPU profile screenshots
Our test goes like this
ng serve
(node --max_old-space-size=12000 ./node_modules/@angular/cli/bin/ng serve
)class="bg-red-500"
)🌍 Your Environment
Anything else relevant?
TailwindCSS 2.2.0 Changelog on JIT mode
The text was updated successfully, but these errors were encountered: