mars / heroku-cra-node

⚛️ How to use create-react-app with a custom Node server on Heroku
MIT License
927 stars 226 forks source link

Version using yarn instead of npm please? #13

Closed invegat closed 6 years ago

mars commented 6 years ago
  1. clone or fork this repo
  2. run yarn install
  3. commit the resulting yarn.lock lockfile
  4. deploy to Heroku
invegat commented 6 years ago

To run yarn at all with "git push heroku master" needed to git rm both package-lock.json files, haven't found any yarn replacement for "npm install --only=dev " of "heroku-postbuild": "cd react-ui/ && npm install && npm install --only=dev --no-shrinkwrap && npm run build

mars commented 6 years ago

If you move the entries in react-ui/package.json devDependencies to dependencies, then that dev deps command is not necessary, could be changed to:

"heroku-postbuild": "cd react-ui/ && yarn install && npm run build"

The whole reason that --only=dev --no-shrinkwrap exists is to work with the React app exactly as it's produced by create-react-app.

invegat commented 6 years ago

Wow, thanks, that worked.

invegat commented 6 years ago

Using all yarn also worked. "heroku-postbuild": "cd react-ui/ && yarn install && yarn build"

rokit commented 6 years ago

Here is how I incorporated yarn:

This way you can keep react-scripts as a dev dependency and use yarn as well.