Skip to content

Conversation

@brad-richardson
Copy link
Contributor

No description provided.

},
"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.


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.

3 participants