I have a react app with two package.jsons. The frontend currently won’t update unless I run npm run build
each time… I would like to see my frontend changes instantly without having to rebuild it each time. The frontend is react (v 18.3.1) and the backend is in Express. This is what my codebase structure looks like after I only include the relevant folders/files:
client/
build/
src/
index.tsx
package.json // client side package.json
tsconfig.json
server/
dist/
index.js
index.ts
package.json // server side package.json
client side package.json scripts:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
server side package.json scripts:
"scripts": {
"build": "npx tsc",
"start": "node dist/index.js",
"dev": "concurrently "npx tsc --watch" "nodemon -q dist/index.js""
}
I’ve tried tweaking the scripts in my client’s package.json file but I still need to run “npm run build” for new changes to appear.
Please let me know if you need any additional information! Thank you for for all of your help!
kuroneko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4