tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

Dev server returns 500 "Internal server error: Unexpected semicolon" if there is an additional semicolon in a module.css file

Open ChenPeleg opened this issue 1 year ago • 6 comments

What version of Tailwind CSS are you using?

4.1.11

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

For example: postcss-cli 11.0.0, Next.js 15.1.7, Vite 6.1.0

What version of Node.js are you using?

"vite": "^7.0.0",

What browser are you using?

Chrome

What operating system are you using?

Windows

Reproduction URL

A Tailwind Play link or public GitHub repo that includes a minimal reproduction of the bug. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private/confidential, since we want a link to a separate, isolated reproduction anyways.

A reproduction is required when filing an issue — any issue opened without a reproduction will be closed and you'll be asked to create a new issue that includes a reproduction. We're a small team and we can't keep up with the volume of issues we receive if we need to reproduce each issue from scratch ourselves.

Describe your issue

Description

Dev server returns 500 "Internal server error: Unexpected semicolon" if there is an additional semicolon in a module.css file

How to reproduce (only the bare minimum)

"dependencies": { "react": "^19.1.0", "react-dom": "^19.1.0" }, "devDependencies": { "@tailwindcss/vite": "^4.1.11", "@vitejs/plugin-react": "^4.5.2", "tailwindcss": "^4.1.11", "vite": "^7.0.0", }

// Component.tsx import styles from "./Component.module.css"

// Component.module.css .abc { color: black;; } This happens if there are two consecutive semicolons

Current behavior

Dev server returns 500 "Internal server error: Unexpected semicolon"

Expected behavior

Throw something else

ChenPeleg avatar Jul 13 '25 09:07 ChenPeleg

Consider providing a git repo that reproduces the issue and we can take a look for you.

wongjn avatar Jul 13 '25 09:07 wongjn

https://github.com/ChenPeleg/tailwind-dev-server-500

Hope this is clear, if not, tell me

ChenPeleg avatar Jul 13 '25 10:07 ChenPeleg

Seems like you have an extra semi-colon in src/component/Component.module.css (unless this is a special CSS module syntax I don't know about):

 .a {
-  color: blue;;
+  color: blue;
 }

wongjn avatar Jul 13 '25 10:07 wongjn

Yes but its better IMO for the development experience for the dev server not to throw 500, but give a better understanding of the issue, an stack trace snippet ect.

Besides that most modern browsers are forgiving towards these types of errors.

Thank you

ChenPeleg avatar Jul 13 '25 10:07 ChenPeleg

I thought I'd already landed the fix for this (it came up a little while ago) but apparently never did. I've merged in a fix and it'll be available in the next release.

You can also test it with our insiders builds — this may take about 20–30m to build and publish tho:

npm install tailwindcss@insiders @tailwindcss/vite@insiders

thecrypticace avatar Jul 14 '25 15:07 thecrypticace

Thank you!

ChenPeleg avatar Jul 14 '25 17:07 ChenPeleg