Workflow for React UI development
bencao opened this issue · 2 comments
Hi Team, I tried the status example to get an idea of how React development would look like in the Serverless Cloud.
Here's a log of my attempts:
- First I tried to change some title text in a component file, and although the
cloud
syncing shows that "Successfully updated your code in less than a second" the change wasn't reflected in my personal instance. - Then, I ran
yarn
in the frontend folder, which resulted in thecloud
syncing process keeping updating for maybe a few minutes (I guess it is related to the massive node_modules folder in the frontend folder?) - The next step I tried is to run
yarn build
which generates the updated bundle to replace the one instatic
folder, the build took 10s for this small starter project. After build it tookcloud
syncing a few additional seconds (about 7s) to upload the updated static files. - After all those were done I tried to access my personal instance, the first request I tried failed with a blank screen. The second one worked.
Overall, I would say at current stage, the React dev workflow is still clumsy and relies on many manual operations. Also the round trip for testing even a small text change is more than 1 minute, which is a big regression comparing to the experience offered by modern framework like Nextjs and create react app.
Understood that we're still in early limited preview phase, but out of curiousity, I would like to hear some thoughts from the team on what's in your roadmap, and what the ideal React development workflow would look like when the Serverless Cloud has unleashed its full potential?
Hi @bencao! Thanks for the detailed feedback.
This is certainly not the workflow we envision or how it should work now. First, please make sure you are on v2.2.1
of the CLI. We've added some major performance enhancements to the syncing capabilities that should reduce most code change syncs to less than a second. Larger files (like big old react-starter templates in node_modules) will still be limited by connection speed. However, those should only need to be synced once.
The SPA workflow can be optimized a bit by following the instructions here: https://www.serverless.com/cloud/docs/apps/static-assets
Using the .serverlessignore
file, you can keep your work together and only sync the build files. However, right now you do need to have a separate terminal window open to handle your react builds. We are working on ways to optimize this process, so please stay tuned. And, of course, your ideas are very welcome.
Some of the issues you're having seem like bugs and we will investigate immediately.