Skip to content

Rails 8: 404 request to /assets/tailwindcss in fresh project with esbuild #581

@JangoCG

Description

@JangoCG

In a fresh Rails 8 project using tailwind and esbuild, the browser always tries to request a non-existent asset:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:3000/assets/tailwindcss

Tailwind itself is working correctly (classes apply, CSS compiles).
But this extra GET request to /assets/tailwindcss fails with 404 on every page load.

Steps to reproduce

rails new railstailwindbug \
  --javascript=esbuild \
  --css=tailwind

cd railstailwindbug
bin/dev

Then open http://localhost:3000/
Check the browser console → you’ll see the 404 for /assets/tailwindcss.

Expected behavior
No request to /assets/tailwindcss should be made, since the file does not exist.
Only the compiled Tailwind CSS should be loaded.

Actual behavior
Every page load triggers a GET request to /assets/tailwindcss, which fails with:

GET http://localhost:3000/assets/tailwindcss 404 (Not Found)

This issue persists even when deploying the app using the official Dockerfile and Kamal.

Environment

  • Rails: 8.0.2.1
  • M4 Mac Max
  • Happens when running locally with bin/dev
  • Also happens when deployed with kamal on an AMD VPS

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