阻止Heroku修剪Dev依赖项

时间:2018-11-12 05:41:25

标签: heroku

我一直试图阻止heroku修剪我的开发依赖项。这是我的配置: 我的构建脚本是:"build": "NPM_CONFIG_PRODUCTION=false webpack -mode production" 并且我添加了"heroku-postbuild": "npm run build" 我的依存关系:

"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"
  }

我希望对配置有任何帮助,因为我不想将自己的开发依赖项添加到我的依赖项中。

1 个答案:

答案 0 :(得分:2)

使用以下方法将Heroku env var NPM_CONFIG_PRODUCTION设置为false

  

heroku config:set NPM_CONFIG_PRODUCTION = false

而不是尝试在npm脚本中进行设置。