rebuild project on file change
Is there a way to force wasp to rebuild all the code without having to do a full clean? Replacing all the node modules takes way too long!
9 Replies
Hi @cmilazzo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, Wasp provides a way to rebuild your project on file changes without having to do a full clean. When you run
wasp start
, it launches your Wasp app in development mode. This command automatically watches for any changes to .wasp files or files in the src/
directory and reflects those changes in the browser. This means that your project is rebuilt each time you make a change to these files, without having to replace all the node modules.
However, if you're experiencing issues with the rebuild process, such as unnecessary rebuilds or file changes not being detected, these could be due to known issues with Wasp's file watching procedures. For example, there have been reports of Wasp trying to copy temporary files that no longer exist, causing it to crash, or not detecting file changes when running in WSL2 on a Windows file system. There's also an open issue to investigate how file watching works in Wasp, particularly with the restructuring in Wasp 0.12.0.
If you're experiencing any of these issues, you might want to follow the progress on these issues or contribute to the discussion:
- Issue #191: Introduce a delay (e.g. 1s) for recompilation upon file change (https://github.com/wasp-lang/wasp/issues/191)
- Issue #61: On file change, Wasp generator tries to copy a temp file which disappears and makes it crash (https://github.com/wasp-lang/wasp/issues/61)
- Issue #604: RFC: Wasp IDE Integration (https://github.com/wasp-lang/wasp/issues/604)
- Issue #1844: Investigate how our file watching works (https://github.com/wasp-lang/wasp/issues/1844)
- Issue #603: File changes not detected by wasp start in WSL2 when using the Windows filesystem (https://github.com/wasp-lang/wasp/issues/603)
For more information on Wasp's CLI commands, you can refer to the Wasp CLI Reference (https://wasp-lang.dev/docs/general/cli#project-commands).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @cmilazzo, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Yes, I believe you can just delete the
.wasp
folder:
It's still going to install some dependencies (for Wasp's inner workings), but will not reinstall user dependencies.Thank you sodic. This will help a lot on my AWS free tier server. :). It's a very tiny machine and takes forever to do some of these operations.... But it's great for testing out a "real" production system before going live...
What's your setup like on AWS? Which AWS services are you using e.g. EC2, RDS...? 😄 - I'm just curious, unrelated to the question
It's an EC2 instance
Wohooo @cmilazzo, you just became a Waspeteer level 4!
I am actually a bit unsure of how to really deploy it though. Right now I just have github installed and actually build on the production machine, which is definitely NOT how it should be done, but it got me up and running so I can show the prototype to partners. However, I do need to go through the whole process of building a real deploy process and controlling it. I'm a bit surprised there isn't any documentation on how to deploy wasp to a regular Linux box TBH. Maybe I should write that as I figure it out (I've been keeping notes, so shouldn't be too hard to document once I get it correct). The biggest question I have is once I run the wasp build, what do I need to package up and deliver to the prod machine? Is it everything under .wasp/out, or just a subset of that?
FYI we just wrote some instructions on deploying to a VPS https://gist.github.com/infomiho/80f3f50346566e39db56c5e57fefa1fe
We also played around with Caprover PaaS and have a Github action: https://github.com/wasp-lang/deploy-to-caprover-action/tree/main
And of course, some docs on manual deployment for more general concepts: https://wasp-lang.dev/docs/advanced/deployment/manually
In a nutshell, Wasp is just React + Node.js + Postgres, what ever works for that combo, works for Wasp 🙂
Thanks @miho!