When deploying a React app to Heroku the command npm run build is likely to work fine because libraries needed for the build process are listed in dependencies, not in devDependencies in package.json. Since a Vue project has these libraries in devDependencies, we need to install them before run npm run build... and for this reason the command line is more complicated.
Regarding postinstall, it is also expected to work as it is explained in the post. I just prefered the Heroku-specific key named heroku-postbuild to highlight that this is a setup for this specific hosting option.
I consider that Vue is doing the right thing. Libraries that are only used to build the site should be placed in devDependencies instead of dependencies.
I understand that dependencies should be used to list packages that should be bundled into the production build, but the tools that you use to make the build.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Why would you use
Over
Just curious as this is what I use when deploying React apps to Heroku.
Hey,
When deploying a React app to Heroku the command
npm run build
is likely to work fine because libraries needed for the build process are listed independencies
, not indevDependencies
in package.json. Since a Vue project has these libraries indevDependencies
, we need to install them before runnpm run build
... and for this reason the command line is more complicated.Regarding
postinstall
, it is also expected to work as it is explained in the post. I just prefered the Heroku-specific key namedheroku-postbuild
to highlight that this is a setup for this specific hosting option.Ah cool! I remember my first time using heroku and wondering why it wouldn't build... Had some deps in Dev deps!
Why does Vue save them to devDependencies?
I consider that Vue is doing the right thing. Libraries that are only used to build the site should be placed in devDependencies instead of dependencies.
I understand that
dependencies
should be used to list packages that should be bundled into the production build, but the tools that you use to make the build.