Wulf / create-rust-app

Set up a modern rust+react web app by running one command.
https://create-rust-app.dev
Apache License 2.0
1.54k stars 63 forks source link

switch create-react-app to vite #3

Closed sansx closed 2 years ago

sansx commented 3 years ago

hey, I noticed that you use create-react-app to develop frontend, do you have interest switch that to vite, not only vite is lightly, but also it has a awesome plugin can compile you web into wasm vite-plugin-rsw

Wulf commented 2 years ago

hi Sansx, sorry for the late reply. I actually read your issue a week ago or so but I had to think about it and investigate "vite". It's my first time hearing about it and I imagine it's easy to swap in for people who know about it. I think it's just a matter of:

1) deleting the contents of the frontend folder and generating one with vite's project generator, and, 2) having the vite project compile to the build directory that create-rust-app expects.

I'm not opposed to having an option to use vite but that means someone will have to support it as we move forward.

sansx commented 2 years ago

yes, I know you meaning, I'd like give support to this part, it likely I'll make a pr this month. :D ( I'm not very familiar with this project, which I might need help in some ways )

Wulf commented 2 years ago

Awesome, sounds great @sansx, let me know if you have any questions. Feel free to suggest improvements!

sansx commented 2 years ago

Hi, I had switch to vite, and yarn fullstack runs well, by the way, the vite plugin about wasm, is used for develop wasm with frontend at same time, so it can't compile frontend to wasm, my bad, so I'm not sure wether you need this pr. I'm quite interested in this project, if you need further help, please let me know.(like make a graphql version, etc.) :D

Wulf commented 2 years ago

hey @sansx thanks a lot for your work on this, I've taken a brief look over your changes on Friday but I didn't get a chance to try it out and take a deeper dive, I'll do this soon!

Also, with regards to things we can do, I have some items in docs/TODO.md that I think the project needs to move forward. Here are some things I would like to have soon:

Anyway sorry, I've been busy lately and will try to organize something more formal soon

Wulf commented 2 years ago

Just published the documentation website :-)

create-rust-app.dev

sansx commented 2 years ago

Ohh, that looks great.

I'm also busy this month, but the lucky thing is switch to vite is not difficult, so I had take some time to finish it, the good news is I had start getting familiar with this project, but busy tho.

And I think if we talk in this issue, it will be extremely long, and might confuse others user, so I closed this issue, and had look for another contact way but found none of it 😂

If you think it's ok, we can continue in this issue, or you can send me a email with a contact way, or we just use the email 😉

Wulf commented 2 years ago

I'll send you an email!

Also, do you think it's not worth adding vite support now because it doesn't compile to wasm? Is there any other advantage to vite over standard create-react-app?

pedrozaalex commented 2 years ago

Hi @Wulf !

I'm new to the project, just came from your Reddit post and would love to get involved.

Answering your last question, vite does have many advantages when compared to CRA. The biggest one for me is the DX. I've worked on a large project that used CRA and let me tell you, webpack simply isn't able to handle it well. Simple changes to css files take forever to recompile, the hot reload eventually breaks after a while. It's not pretty.

With vite, it's a whole other story. Regardless of how big your project gets, it takes the same amount of time to recompile changes.

Check out this comparison. There are also other benefits, like vite is a LOT easier to configure than webpack, ootb better TS support etc.

Besides all that, I think vite would also allow the project to expand beyond react with ease.

Anyway, as I said earlier, I really like this project and would like to help out, but there aren't many issues available to work on. How can I contribute to the project?

Wulf commented 2 years ago

hey @pedrozaalex, welcome 🙌 and thanks for sharing.

I agree vite definitely sounds like the way forward! When @sansx brought this up, I wasn't too familiar with the project, but after receiving lots of feedback about supporting other frontend frameworks, I looked into it again.

As for contributions -- they are more than welcome and appreciated! I've written notes in docs/TODO.md but kindly give me some time and I'll refine each point into an issue (at least the items that are still relevant).

Wulf commented 2 years ago

aaannnddd, we've landed vitejs integration in 6.0.0 :rocket: !

Right now it's only available in actix-web, but I'm hoping to add it for poem later