I'm encountering an issue while integrating tailwindcss with postcss into my React Application (built using create-react-app
).
To address this, I modified the scripts
section in my package.json. Here is how my updated package.json appears:
{
"name": "octopus-one",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"classnames": "^2.2.6",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"scripts": {
"build:css": "postcss src/styles/index.tailwind.css -o src/styles/index.css",
"watch:css": "postcss src/styles/index.tailwind.css -o src/styles/index.css -w",
"start": "npm run watch:css && react-scripts start",
"build": "npm run build:css && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"autoprefixer": "^9.7.6",
"node-sass": "^4.14.1",
"postcss-cli": "^7.1.1",
"tailwindcss": "^1.4.6"
}
}
After making these changes, I executed yarn start
, but encountered the following output:
C:\Dev\octopus-one>yarn start
yarn run v1.21.1
$ npm run watch:css && react-scripts start
[email protected] watch:css C:\Dev\octopus-one
postcss src/styles/index.tailwind.css -o src/styles/index.css -w
_
The development server from the default create-react-app
setup does not seem to be starting.
Despite no visible errors, it seems like npm run watch:css
is constantly running without transitioning to react-scripts start
. It appears there might be a mistake in my package.json
, but I'm unsure of the necessary steps to rectify this.
My goal is to have react-scripts start
initiate after the completion of npm run watch:css
, so I can access the development server as usual (on localhost:3000).
As a newcomer to react and embarking on my first experience with tailwindcss within a React application, any assistance would be greatly appreciated. Thank you.