I setup a new Astro project with TailwindCSS, running the website from the dev server works fine, but when building the static site, it does not seem to include TailwindCSS in the final dist folder therefore making the website display in standard HTML.
package.json
{
"name": "",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.9.5",
"@tailwindcss/vite": "^4.1.17",
"astro": "^5.15.4",
"tailwindcss": "^4.1.17",
"typescript": "^5.9.3"
}
}⏎
astro.config.mjs
// @ts-check
import { defineConfig } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
// https://astro.build/config
export default defineConfig({
vite: {
plugins: [tailwindcss()],
},
});