Skip to content

ng serve: compile time 10x slower with tailwind 2.2.x #21228

Closed
@gianmd

Description

@gianmd

🐞 Bug report

Command (mark with an x)

  • serve

Is this a regression?

Problematic Angular-cli version: ^11.2.10

Previous TailwindCSS version with no problem: TailwindCSS@2.1.2

Problematic Version: TailwindCSS@2.2.4

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 latest postcss-loader@^4 and postcss-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 tailwindcss@2.2.4 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

With TailwindCss 2.1.2
With TailwindCss 2.2.4

Our test goes like this

  1. Run ng serve ( node --max_old-space-size=12000 ./node_modules/@angular/cli/bin/ng serve )
  2. Add a tailwind class to any div element (class="bg-red-500")
  3. Save file

🌍 Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 11.2.10
Node: 14.16.1
OS: darwin x64

Angular: 11.2.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1102.10
@angular-devkit/build-angular      0.1102.10
@angular-devkit/core               11.2.10
@angular-devkit/schematics         11.2.10
@angular/cdk                       11.2.10
@angular/cli                       11.2.10
@angular/fire                      6.1.4
@angular/google-maps               11.2.10
@angular/material                  11.2.10
@angular/material-moment-adapter   11.2.10
@schematics/angular                11.0.1
@schematics/update                 0.1102.10
ng-packagr                         11.0.2
rxjs                               6.6.7
typescript                         4.0.5
webpack                            4.44.2

Anything else relevant?

TailwindCSS 2.2.0 Changelog on JIT mode

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions