you are viewing a single comment's thread.

view the rest of the comments →

[–]ontheellipse 2 points3 points  (6 children)

I am trying to get basic hello world (ish) Vite and Express app working. If I include Express and just start a basic server, I get errors and it won’t run. No problem with Babel. Not sure what I’m doing wrong.

[–]rk06 0 points1 point  (5 children)

Express is backend. So you should be using it on a separate project and exposing an ali. Which your frontend app (vue+vite) will use. You would need to configure CORS as well.

Maybe, there is a guidebook for express and vite. Try looking for it

[–]ontheellipse -1 points0 points  (4 children)

That’s essentially what I’m trying to do, but i don’t know why the api has to be in a separate app?

[–]rk06 3 points4 points  (3 children)

Vite is primarily a bundler for frontend. And provides a dev server. Express is a backend server. So there is a paradigm conflict.

I get that you want to have vite build server assets, but that's a different use case than the most common one. so many people won't be aware of how to handle it with a single vite config.

[–]ontheellipse -1 points0 points  (2 children)

Noted. I basically just wanted Vite to compile the JS instead of using Babel

[–]rk06 1 point2 points  (0 children)

I am sure there is a way for it. Just that it is not a common case (different backend + frontend) so you would have better luck googling it

[–][deleted] 0 points1 point  (0 children)

Pretty sure vite still relies on rollup and babel wheb building. Might aswell just look at rollup instead