-
Notifications
You must be signed in to change notification settings - Fork 1
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
Config: Migrate from CRA to Vite (wait for release 1.9.0 to merge) #688
Conversation
c02fa13
to
44a5e34
Compare
44a5e34
to
ae1d899
Compare
Why? |
A very good question! Apparently I have forgotten to provide a proper explanation in the PR description 😅 So yes, I would hereby like to propose to think about migrating from CRA (Create React App) to Vite. CRA - which runs on Webpack under the hood - is a deprecated / dead / no longer maintained project and the React team no longer recommends it (CRA used to be on that page). They do recommend things like Next.js or Remix, which we could also consider, but those projects require a completely different setup (with server-side rendering). For our situation - serving a build of static assets - Vite is probably the best option. I have used Vite in React projects before and I have also migrated CRA projects to Vite before. Apart from the fact that CRA is no longer maintained, Vite also has benefits:
For the rest not much changes. The application works more or less the same. There are some files and folders that need to be in a different location and the environment variables are no longer to be prefixed with |
ae1d899
to
2311348
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Still have to see how it plays out in practice. Please do change the VITE_...
variable names to something more descriptive, see my comments. Users need to at least have an idea of what these variables are for.
447ba19
to
285f2bd
Compare
285f2bd
to
e48ee6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please still change the variable names here? Either leave it as REACT
(since we're still serving / building React here), or change to FRONTEND
. The last setting in this list (STRICT
) is arguably a React setting, right?
That's not possible. CRA requires |
|
Yeah, we can definitely do that, especially since we have to update our environment variables anyway 👍 |
dc1a4b0
to
fe7e2c1
Compare
…fter rebase onto develop
e0c7fc4
to
84ee818
Compare
I would hereby like to propose to think about migrating from CRA (Create React App) to Vite. CRA - which runs on Webpack under the hood - is a facebook/create-react-app#13072 and the React team no longer recommends it (CRA used to be on that page). They do recommend things like Next.js or Remix, which we could also consider, but those projects require a completely different setup (with server-side rendering). For our situation - serving a build of static assets - Vite is probably the best option. I have used Vite in React projects before and I have also migrated CRA projects to Vite before. Apart from the fact that CRA is no longer maintained, Vite also has benefits:
It's way faster (hence the name, Vite is fast in French)
It has typescript built-in, making it easier to migrate to typescript if we want to
For the rest not much changes. The application works more or less the same. There are some files and folders that need to be in a different location and the environment variables are no longer to be prefixed with REACT_APP_, but with VITE_.