mars / create-react-app-buildpack

โš›๏ธ Heroku Buildpack for create-react-app: static hosting for React.js web apps
MIT License
3.28k stars 653 forks source link

Build runs twice #168

Closed dcporter44 closed 4 years ago

dcporter44 commented 4 years ago

Heroku has recently started executing build automatically: https://devcenter.heroku.com/changelog-items/1557

This means that when using this buildpack, build is run two times. Once by Heroku and once by this buildpack.

If you add "heroku-run-build-script"=false to package.json, it will prevent Heroku from running automatically.

This should be added to the documentation of this buildpack.

mars commented 4 years ago

Hi @dcporter44 ๐Ÿ˜ƒ Thanks for the feedback.

That change happened almost a year ago, and we already performed the transition on this buildpack.

If you're seeing two build runs, then there's probably something else going on with your app. Do you have other pre or post build scripts in your package.json that would trigger another build?

dcporter44 commented 4 years ago

I'm actually noticing that "heroku-run-build-script"=false is actually not doing anything and its still building twice :(

I havent messed with the package.json file at all. I'm using it straight out of the box from latest CRA version

mars commented 4 years ago

I just created an new app with create-react-app 3.4.0 (current as of now), pushed it to a new Heroku app with this buildpack, the build ran once, and it started-up healthy ๐Ÿ‘

What does heroku buildpacks return for your app?

What are the contents of the package.json?

mars commented 4 years ago

My guess is that either your app has the buildpack set twice (maybe as two different identifiers) or that thereโ€™s a pre or post install script performing build again.

Not an issue with this buildpack itself.

dcporter44 commented 4 years ago

Hey, I figured it out. I also had the heroku/node buildpack added on my app. I just removed that and now it's only running once. ๐Ÿ‘