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

react-ts: make sure react-scripts works, use new jsx runtime #13

Merged
merged 3 commits into from
Sep 1, 2023

Conversation

fvsch
Copy link
Contributor

@fvsch fvsch commented Aug 31, 2023

This PR updates the react-ts template with the following goals in mind:

  1. Use the new JSX runtime introduced in 2020, that doesn't require importing the React namespace. This coding style is used by the new React docs, by create-react-app@latest, and more.

  2. Make sure that the project can be downloaded an ran locally with npm install && npm start. In my testing, react-scripts:

    • Required a tsconfig.json to be present to accept importing TypeScript files.
    • Required the package.json to have a browserslist config. By default it will add a verbose one, so to keep things compact I went with "browserslist": ["defaults"].

I also considered replacing react-scripts with vite. That would be my preference, by Vite uses conventions like an index.html at the root (not in a public folder), copying the public folder as-is, having the index.html request resources like styles and scripts, etc. All conventions which work well in WebContainer projects, but not in EngineBlock projects.

@fvsch fvsch requested review from sulco and donmckenna August 31, 2023 08:22
Copy link
Member

@sulco sulco left a comment

Choose a reason for hiding this comment

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

Thank you! 🙏

@fvsch fvsch merged commit f8e4e62 into main Sep 1, 2023
1 check passed
@fvsch fvsch deleted the fvsch/modernize-react-ts branch September 1, 2023 15:00
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.

2 participants