Reputation: 157
I am trying to build a Django and react app, but I want Django to serve the html. At the moment I have to keep building the scripts (with webpack) after I make changes, which is costing development time. Is there a way to build the main.js file everytime I make changes? Same thing that react-scripts does but without the {host}:3000 server running
Upvotes: 2
Views: 160
Reputation: 414
Try this function of webpack:
https://webpack.js.org/configuration/watch/
Webpack approach might be easier to do without changing the routing and using react dev serving. I don't see the webpack build config so can't say much but you can definitely do stuff with watch
config.
This article explains what you want: https://fractalideas.com/blog/making-react-and-django-play-well-together-hybrid-app-model/ if the thing you are doing is true hybrid app.
Upvotes: 3