I created a react project and ran it to test. But it looks like tailwindcss is not enabled. I’m not able to style elements.
App.jsx
const App = () => {
return (
<div className="App">
<h1 className="text-3xl underline">
Hello world!
</h1>
</div>
)
}
export default App
tailwind.config.jsx
/** @type {import('tailwindcss').Config} */
import { vitePluginTailwindcss } from 'vite-plugin-tailwindcss';
module.exports = {
mode: 'jit',
purge: [
'./public/**/*.html',
'./src/**/*.{js,jsx,ts,tsx,vue}',
],
theme: {
extend: {},
},
plugins: [vitePluginTailwindcss],
}
I added mode:jit and plugin to try and fix, but not fixed. There are no errors
3
Answers
try to change the tailwind.config.jsx file to:
Make sure that you have added the
postcss.config.cjs
file to the project.and add
The same question has been asked previously on StackOverflow. You can refer to that question for more information. Tailwind class is not working after installed