Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Heroku from Pruning Dev Dependencies

Tags:

heroku

I have been trying to stop heroku from pruning my dev dependencies. Here is my config: My build script is: "build": "NPM_CONFIG_PRODUCTION=false webpack -mode production" And I have added "heroku-postbuild": "npm run build" My Dependencies:

"dependencies": {
    "express": "^4.16.3",
    "react": "^16.5.2",
    "react-dom": "^16.5.2"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "babel-eslint": "^10.0.0",
    "babel-loader": "^8.0.0",
    "clean-webpack-plugin": "^0.1.19",
    "concurrently": "^4.0.0",
    "css-loader": "^1.0.0",
    "eslint": "^5.0.0",
    "eslint-config-airbnb": "^17.0.0",
    "eslint-plugin-import": "^2.11.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.7.0",
    "file-loader": "^2.0.0",
    "html-webpack-plugin": "^3.2.0",
    "nodemon": "^1.17.3",
    "style-loader": "^0.23.0",
    "url-loader": "^1.0.1",
    "webpack": "^4.5.0",
    "webpack-cli": "^3.0.8",
    "webpack-dev-server": "^3.1.3"
  }

I would appreciate any help with the config as I don't want to add my dev dependencies to my dependencies.

like image 883
Rohan Dhar Avatar asked Nov 12 '18 05:11

Rohan Dhar


People also ask

Does Heroku install Dev dependencies?

By default, Heroku will install all dependencies listed in package. json under dependencies and devDependencies . After running the installation and build steps Heroku will strip out the packages declared under devDependencies before deploying the application.

Does Heroku run npm build?

By default, Heroku runs npm start while starting deployed Node.

What version of Nodejs does Heroku use?

You should always specify a version of Node (as illustrated here), but if you do not, Node. js 16 will be installed for you. Starting November 28th, 2022, free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis® will no longer be available.


1 Answers

Set Heroku env var NPM_CONFIG_PRODUCTION to false with

heroku config:set NPM_CONFIG_PRODUCTION=false

instead of trying to set it in your npm script. See docs.

like image 96
Yoni Rabinovitch Avatar answered Sep 20 '22 23:09

Yoni Rabinovitch