i have been using tailwindcss 2 but i wanted to upgrade to 3. I followed their tutorial but is not working i dont know why.
tailwind.config.js
JavaScript
x
12
12
1
module.exports = {
2
content: [
3
"./src/**/*.{js,jsx,,ts,tsx}",
4
],
5
theme: {
6
extend: {
7
8
},
9
},
10
plugins: [],
11
}
12
postcss.config.js
JavaScript
1
7
1
module.exports = {
2
plugins: {
3
tailwindcss: {},
4
autoprefixer: {},
5
},
6
}
7
index.css
JavaScript
1
4
1
@tailwind base;
2
@tailwind components;
3
@tailwind utilities;
4
index.css
is imported in index.tsx.
index.tsx
file
JavaScript
1
17
17
1
import ReactDOM from 'react-dom';
2
import './index.css';
3
import 'react-toastify/dist/ReactToastify.css';
4
import App from './App';
5
import { Provider } from 'react-redux';
6
import { store } from './redux/store';
7
import { BrowserRouter } from 'react-router-dom'
8
9
ReactDOM.render(
10
<BrowserRouter>
11
<Provider store={store}>
12
<App />
13
</Provider>
14
</BrowserRouter>,
15
document.getElementById('root')
16
);
17
package.json
JavaScript
1
83
83
1
{
2
"name": "client",
3
"version": "0.1.0",
4
"private": true,
5
"dependencies": {
6
"@dicebear/avatars": "^4.8.5",
7
"@dicebear/avatars-avataaars-sprites": "^4.8.5",
8
"@fortawesome/fontawesome-svg-core": "^1.2.36",
9
"@fortawesome/free-brands-svg-icons": "^5.15.4",
10
"@fortawesome/free-solid-svg-icons": "^5.15.4",
11
"@fortawesome/react-fontawesome": "^0.1.15",
12
"axios": "^0.21.1",
13
"numeral": "^2.0.6",
14
"react": "^17.0.2",
15
"react-canvas-confetti": "^1.2.1",
16
"react-cookie": "^4.0.3",
17
"react-countdown-circle-timer": "^2.5.3",
18
"react-dom": "^17.0.2",
19
"react-ga": "^3.3.0",
20
"react-google-login": "^5.2.2",
21
"react-redux": "^7.2.4",
22
"react-router-dom": "^5.2.0",
23
"react-scripts": "4.0.3",
24
"react-select": "^4.3.1",
25
"react-toastify": "^7.0.4",
26
"react-window": "^1.8.6",
27
"redux": "^4.1.1",
28
"redux-thunk": "^2.3.0",
29
"socket.io-client": "^4.1.3",
30
"typescript": "^4.3.5"
31
},
32
"scripts": {
33
"start": "react-scripts start",
34
"build": "react-scripts build",
35
"eject": "react-scripts eject"
36
},
37
"eslintConfig": {
38
"extends": [
39
"react-app",
40
"react-app/jest"
41
]
42
},
43
"browserslist": {
44
"production": [
45
">0.2%",
46
"not dead",
47
"not op_mini all"
48
],
49
"development": [
50
"last 1 chrome version",
51
"last 1 firefox version",
52
"last 1 safari version"
53
]
54
},
55
"devDependencies": {
56
"@testing-library/cypress": "^8.0.0",
57
"@testing-library/jest-dom": "^5.14.1",
58
"@testing-library/react": "^12.0.0",
59
"@types/jest": "^26.0.24",
60
"@types/node": "^12.20.19",
61
"@types/numeral": "^2.0.1",
62
"@types/react": "^17.0.15",
63
"@types/react-dom": "^17.0.9",
64
"@types/react-redux": "^7.1.18",
65
"@types/react-router-dom": "^5.1.8",
66
"@types/react-select": "^4.0.17",
67
"@types/react-window": "^1.8.5",
68
"@types/redux": "^3.6.0",
69
"@types/tailwindcss": "^2.2.1",
70
"@types/typescript": "^2.0.0",
71
"@typescript-eslint/eslint-plugin": "^4.29.0",
72
"@typescript-eslint/parser": "^4.29.0",
73
"autoprefixer": "^10.4.0",
74
"concurrently": "^6.5.1",
75
"cypress": "^8.3.1",
76
"postcss": "^8.4.5",
77
"redux-devtools-extension": "^2.13.9",
78
"redux-mock-store": "^1.5.4",
79
"tailwindcss": "^3.0.7"
80
}
81
}
82
83
Text.jsx
JavaScript
1
11
11
1
const Test = () => {
2
return (
3
<div className='flex text-green-500'>
4
<h1>Text Green</h1>
5
6
</div>
7
)
8
}
9
10
export default Test
11
Advertisement
Answer
I found the issue, you need to update react-scripts to the latest update
npm install react-scripts@latest