Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quick setup section for Vite in documentation #7416

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hichemfantar
Copy link
Contributor

@hichemfantar hichemfantar commented Jan 8, 2025

Introduce a new section in the React project setup guide to provide a quick start for using Vite as a build tool. This addition aims to enhance the onboarding experience for developers looking to create projects with Vite.

Description is an abridged version of the overview section from the vite site.

closes #5797

image

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
19-react-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 4:27pm
react-dev ✅ Ready (Inspect) Visit Preview Jan 8, 2025 4:27pm

Copy link

github-actions bot commented Jan 8, 2025

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@@ -31,6 +30,16 @@ If your app has unusual constraints not served well by these frameworks, or you

</DeepDive>

## Quick Setup {/*quick-setup*/}
Copy link
Contributor

@karlhorky karlhorky Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of emphasizing that this option is "quick", maybe it would be better to emphasize what the drawbacks are (drawbacks are already described in the section "Can I use React without a framework?" above) and what developers miss out on with a simple Vite setup:

  1. Maybe a better heading here would be "Frontend-only React" or something (since Vite is not integrated with React Server Components yet - aside from some Vite RSC experiments)
  2. Since the Vite option has drawbacks, I guess the section makes more sense further down, after the "Production-grade React frameworks"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, thinking more on it, it seems as if the "Can I use React without a framework?" section above already covers a lot of the drawbacks to using setups like Vite, and also links to it

Maybe it doesn't need to be more visible than that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that it isn't visible at all.

Check the issue connected to this PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please stop forcing users to choose NextJS. This makes no sense. SPA is still the best choice for most projects that don't need SEO optimization.

Copy link
Contributor

@karlhorky karlhorky Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next.js and other production-ready frameworks also have SPA support:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hosting platforms generally let you configure a reverse proxy to maintain SPA and MPA like routing, so that shouldn't cause issues with static exports specifically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next js Static export still isn’t an spa though.
Remix has an spa mode but even that doesn’t behave like a real spa
remix-run/remix#9008

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do find it strange how React is supposedly just a library, and yet it almost dictates that you should use a full-stack framework. Almost as if there is some financial incentive involved between React and Vercel, but I'm a cynic so ...

In either case, the current wording makes it seem as if the only correct way to use React is with a full-stack framework, and that everything else is bad - this wording drives people away from using React as just a front-end SPA, which is still very much possible to do. If this is the intent then perhaps the documentation should say that you do not recommend using React as a SPA at all, and then people can simply start using Vue or something else instead. Right now the wording is sort of open to interpretation in a way, although heavily leaning towards telling you to use Next.js.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React is not forcing you to do anything. Next doesn't require Vercel, and React doesn't require Next, it just recommends a meta framework for a better experience.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Better" experience for who, for Vercel?

Since from CRA deprecation, the React docs have changed from a impartial to a Next/Vercel oriented instructions.

Next is a vendor lock-in, Next is not SPA, Next only make sense for Server Side Rendering (SEO), deploying Next outside Vercel is a pain close to the death.

"Better" experience is far away from Next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List Vite at the same level as SSR frameworks as a way to start a new React project
6 participants