Skip to content

[v4] Angular compilation errors in Docker are preventing TailwindCSS from working. #16364

Open
@johnadrian63

Description

@johnadrian63

What version of Tailwind CSS are you using?

TailwindCSS v4.0

What build tool (or framework if it abstracts the build tool) are you using?

  • Docker Desktop 4.38.0
  • Node:22-alpine
  • Angular 19.1.4 (CLI, Core)
  • Typescript 5.7.2
  • PostCSS 8.5.1
  • TailwindCSS 4.0.4

What version of Node.js are you using?
Node:22-alpine (Docker image)

What browser are you using?
Chrome

What operating system are you using?
Windows 11 Pro 64-bit

Reproduction URL
https://github.com/johnadrian63/tailwind-docker

Describe your issue
I have an Angular application that uses TailwindCSS v4. It works perfectly on my local machine, but when I run it inside a Docker container, I encounter compilation errors that prevent TailwindCSS from functioning properly.

Describe the problem you're seeing, any important steps to reproduce and what behavior you expect instead.
Here is the compilation errors that I encountered:

Image

2025-02-08 13:20:41 
2025-02-08 13:20:41 > webclient@0.0.0 start:webapp
2025-02-08 13:20:41 > ng serve --project=webapp --configuration development --port 4200 --host 0.0.0.0 --poll 800
2025-02-08 13:20:41 
2025-02-08 13:20:42 
2025-02-08 13:20:42 Warning: This is a simple server for use in testing or debugging Angular applications
2025-02-08 13:20:42 locally. It hasn't been reviewed for security issues.
2025-02-08 13:20:42 
2025-02-08 13:20:42 Binding this server to an open connection can result in compromising your application or
2025-02-08 13:20:42 computer. Using a different host than the one passed to the "--host" flag might result in
2025-02-08 13:20:42 websocket connection issues. You might need to use "--disable-host-check" if that's the
2025-02-08 13:20:42 case.
2025-02-08 13:20:42     
2025-02-08 13:20:42 Component HMR has been enabled.
2025-02-08 13:20:42 If you encounter application reload issues, you can manually reload the page to bypass HMR and/or disable this feature with the `--no-hmr` command line option.
2025-02-08 13:20:42 Please consider reporting any issues you encounter here: https://github.com/angular/angular-cli/issues
2025-02-08 13:20:42 
2025-02-08 13:20:42 ❯ Building...
2025-02-08 13:21:08 ✔ Building...
2025-02-08 13:21:08 Initial chunk files | Names         |  Raw size
2025-02-08 13:21:08 polyfills.js        | polyfills     |  90.20 kB | 
2025-02-08 13:21:08 styles.css          | styles        |  61.93 kB | 
2025-02-08 13:21:08 main.js             | main          |   2.37 kB | 
2025-02-08 13:21:08 
2025-02-08 13:21:08                     | Initial total | 154.50 kB
2025-02-08 13:21:08 
2025-02-08 13:21:08 Application bundle generation complete. [26.484 seconds]
2025-02-08 13:21:08 
2025-02-08 13:21:08 ▲ [WARNING] Comments in CSS use "/* ... */" instead of "//" [js-comment-in-css]
2025-02-08 13:21:08 
2025-02-08 13:21:08     projects/webapp/src/styles.css:2174:11:
2025-02-08 13:21:08       2174 │     https: //github.com/Brooooooklyn/nice/actions !important;
2025-02-08 13:21:08            ╵            ~~
2025-02-08 13:21:08 
2025-02-08 13:21:08 
2025-02-08 13:21:08 ▲ [WARNING] Expected "}" to go with "{" [css-syntax-error]
2025-02-08 13:21:08 
2025-02-08 13:21:08     projects/webapp/src/styles.css:2611:27589:
2025-02-08 13:21:08       2611 │ ...b2R5IHtcclxuICBib3JkZXI6IHNvbGlkIDFweCByZWQ7XHJcbn1cclxuIl19 */
2025-02-08 13:21:08            │                                                                   ^
2025-02-08 13:21:08            ╵                                                                   }
2025-02-08 13:21:08 
2025-02-08 13:21:08   The unbalanced "{" is here:
2025-02-08 13:21:08 
2025-02-08 13:21:08     projects/webapp/src/styles.css:2203:23:
2025-02-08 13:21:08       2203 │   .\[uri\:\/hoge\/\*\] {

Steps to reproduce:

  1. Download Docker Desktop
  2. Download this github repo https://github.com/johnadrian63/tailwind-docker
  3. Go to the root directory of the project and run this docker command to build the image docker build -t docker-test5-webclient-app -f ${PWD}/webclient/projects/webapp/Dockerfile .
  4. Next, run this command to run the container docker run --name docker-test5-webclient-app --env-file ./webclient/config/.env -d -p 8080:4200 -v ${PWD}/webclient/projects/webapp:/app/projects/webapp docker-test5-webclient-app
  5. Go to Docker Desktop and check the container logs. (Please see the screenshot I provided above)

Here is the content of my Dockerfile:

FROM node:22-alpine AS webclient
WORKDIR /app

COPY webclient/package*.json .

RUN rm -rf node_modules package-lock.json \
  && npm install -g @angular/cli@19.1.5 \
  && npm install

COPY webclient/.angular ./.angular
COPY webclient/.postcssrc.json ./
COPY webclient/angular.json .
COPY webclient/tsconfig.json .
COPY webclient/projects/webapp ./projects/webapp

CMD if [ "${ENVIRONMENT}" = "development" ]; then npm run start:webapp; else ng build; fi


# build image
# docker build -t docker-test5-webclient-app -f ${PWD}/webclient/projects/webapp/Dockerfile .
# run image
# docker run --name docker-test5-webclient-app --env-file ./webclient/config/.env -d -p 8080:4200 -v ${PWD}/webclient/projects/webapp:/app/projects/webapp docker-test5-webclient-app

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions