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

Replace CRA with Vite #64

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

Conversation

entriphy
Copy link

@entriphy entriphy commented Apr 9, 2024

Motivation:

  • Commit 163c6b9 causes npm install to fail, as react-scripts requires TypeScript v4, but the project now uses TypeScript v5.
  • Create React App/react-scripts has been abandoned, and Vite is widely considered to be its modern replacement.

Main changes:

  • Add Vite and remove react-scripts from dependencies
  • Replace all scripts that use Create React App with its Vite equivalent in package.json
  • Update other React and MUI dependencies, which fixes some issues when building for production with styled MUI components
  • Move index.html to the root directory (required by Vite)
  • The base URL for the React router is now controlled by the BASE_URL environment variable
    • The user can either set this environment variable or manually change it in vite.config.ts. Otherwise, it defaults to /.
    • i.e. if the user is deploying to deploying to [username].github.com/Website, the user can run BASE_URL=/Website npm run build. The pathSegmentsToKeep variable in public/404.html still has to be changed in this case.

Preview: https://entriphy.github.io/Website

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

Successfully merging this pull request may close these issues.

1 participant