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

create-react-app #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

create-react-app #5

wants to merge 3 commits into from

Conversation

ericclemmons
Copy link
Owner

This can be typical of a SPA that lives alongside GraphQL.

I think the right setup is:

  • packages
    • cra
    • graphql
  • routes
    • /graphql/index.js
    • index.*.js

Where create-react-app doesn't export a middleware, but just has a package.json.

But what's in index.*.js_?

module.exports = require.resolve('cra')

By exporting the path, this means we'll inspect path.resolve(require.resolve('cra'), './package.json') for the following commands:

  • build (Optional)
  • dev(Optional)
  • start

When getting ready for production:

  1. yarn workspaces run build (which should create all of the static assets)
  2. yarn start

@ericclemmons
Copy link
Owner Author

Because of this error:

upath@1.0.4: The engine "node" is incompatible with this module. Expected version ">=4 <=9". Got "10.13.0"

(facebook/create-react-app#4367)

I had to run:

yarn config set ignore-engines true
yarn create react-app packages/react-app

@ericclemmons
Copy link
Owner Author

Came so close! The problem is create-react-app can't serve assets from a folder besides / in development:

facebook/create-react-app#6135

@ericclemmons
Copy link
Owner Author

Waiting on facebook/create-react-app#4158

This was referenced Jan 28, 2019
@ericclemmons ericclemmons added the enhancement New feature or request label Feb 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant