Keystone: Create a React App

Created on 18 Sep 2019  路  6Comments  路  Source: keystonejs/keystone

Create a React App. Basically an express middleware that runs create-react-app in dev and builds in prod.

Question: React uses the webpack-dev-server should we proxy to this or re-create the process with an express middleware?

medium 3 needs-review

Most helpful comment

This would be really nice to have, but not a high priority if it takes much time. Setting as low for now. Would be a great contribution 馃憤

All 6 comments

馃 We can use execa to start a child process which basically just runs npm start in the directory, but you're right we'd have to either proxy requests, or start it on a different port and make that clear to the user (but then the "prod" version would be on the same port which has implications for cookies and CORS, etc).

Something like https://github.com/chimurai/http-proxy-middleware might work well 馃憤

Yes! Maybe a proxy middleware is the right move and it can serve any front-end application framework that comes with it's own dev server. The only challenge with that is finding a sensible way to kick-off the applications within the middleware so that it feels like a single yarn dev command.

This would be really nice to have, but not a high priority if it takes much time. Setting as low for now. Would be a great contribution 馃憤

Does it have to be "Create React App"? What about managing a custom webpack configuration?

EDIT: I was able to set up a custom React app configuration that uses webpack dev and hot middleware for development and express static middleware for serving production builds. There are a lot of options missing in webpack configuration.

If you do not require using "Create React App" specifically for webpack configuration, I am willing work on this and provide an extendable interface that allows choosing the source and build directories, as well as extending webpack configuration to add additional features (e.g a user can install svg-loader if necessary).

To get users starting in a fast way, I suggest supporting the following features:

  • Typescript
  • Standard assets (fonts, images etc)
  • CSS Modules, SASS, Styled components (emotion and / or styled-components)
  • Importing GraphQL files (.gql / .graphql)
  • Markdown / MDX

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ricardonogues picture ricardonogues  路  10Comments

molomby picture molomby  路  11Comments

molomby picture molomby  路  11Comments

bholloway picture bholloway  路  18Comments

bothwellw picture bothwellw  路  18Comments