Issue setting up ideal development environment for Cloudflare Pages react app with _worker.js
I have created a webpack-based react app that places the output from npm build in /dist. I have also added a boilerplate _worker.js in to /dist .
When I run wrangler pages dev dist I can access both the react app and the worker in the browser, which is good, however I will have to run npm build each time the React app is updated (changes to _worker.js do seem to be watched).
Running wrangler pages dev -- npm start does work, except that _worker.js is ignored and only the React part of the application is visible in the browser.
My question is essentially, how do I get a development environment setup where changes to both the worker code and the react code are watched and rebuilt when changed? If someone can point me in the right direction I would greatly appreciate it.
1 Reply
That makes sense. I'll stick to wrangler pages dev dist and sort out the React app separately as suggested. Just didn't know if I was missing something obvious. Appreciate your help.