How to deploy node that uses Gulp to heroku

后端 未结 8 1254
遥遥无期
遥遥无期 2020-12-07 16:21

I\'m using gulp and also gulp plugins like gulp-minify-css, gulp-uglify etc (that listed as npm dependencies for my application).

Also I don\'t commit npm_modules fo

8条回答
  •  轮回少年
    2020-12-07 17:03

    The easiest way I found was:

    1. Setup gulp on package.json scripts area:

      "scripts": {
        "build": "gulp",
        "start": "node app.js"
      }
      

      Heroku will run build before starting the app.

    2. Include gulp on dependencies instead of devDevependencies, otherwise Heroku won't be able to find it.

    There is more relevant info about it on Heroku Dev Center: Best Practices for Node.js Development

提交回复
热议问题