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 web app init #24

Merged
merged 5 commits into from
Mar 30, 2021
Merged

React web app init #24

merged 5 commits into from
Mar 30, 2021

Conversation

brad-richardson
Copy link
Contributor

No description provided.

@@ -62,12 +62,12 @@
"supertest": "^4.0.2"
},
"scripts": {
"build": "tsc",
"build": "tsc && (cd ./web && yarn run build)",
Copy link
Contributor Author

@brad-richardson brad-richardson Mar 30, 2021

Choose a reason for hiding this comment

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

We may want to clean this up in the future but I don't know enough to know best practices. I found a few variations but pulled some inspiration from this: https://medium.com/codeduck/a-real-world-project-typescript-express-and-react-4701c0458e9c

The gist of it is that we compile the minified typescript and then move that to the /build folder to serve up from the same output as the server.

@@ -38,6 +38,11 @@ Start service (monitors for file changes and sets debug configs)
yarn start
```

To run the web app (auto-served in production):
```
cd web && yarn start
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not super happy with this because it means spinning up two distinct servers when working in dev but the react-scripts people are pretty inflexible about having react-scripts build produce dev code. Building for production is pretty fast but adding 5-10 seconds to every code change (even when nothing changed on the web app) seemed like a bit much. See: facebook/create-react-app#790

@brad-richardson
Copy link
Contributor Author

Everything I didn't comment on is either some updates for typescript or generated output from create-react-app (using the typescript template).

@brad-richardson brad-richardson changed the title Initial react serving React web app init Mar 30, 2021
@brad-richardson brad-richardson merged commit eb332db into dev Mar 30, 2021
@brad-richardson brad-richardson deleted the brad/react branch March 30, 2021 21:33
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