Rahul Tailwal
Rahul Tailwal

Reputation: 3213

Heroku webpack deploy port binding error

I have package.json with all the dependencies and start script with webpack. On deploying to heroku i am getting Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

"scripts": {
"start": "webpack-dev-server --test"
},

Webpack config file.

var config = {
 entry: './main.js',

output: {
  path:'./',
  filename: 'index.js',
},

devServer: {
  inline: true,
  port: process.env.PORT || 8010
},

module: {
  loaders: [
     {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',

        query: {
           presets: ['es2015', 'react']
        }
     },
     { test: /\.css$/, loader: "style!css" },
  ]
}
}

module.exports = config;

Upvotes: 1

Views: 1284

Answers (1)

Rohit Kumar
Rohit Kumar

Reputation: 1792

Kinda a late tho... The above code wont work on heroku because the webpack devServer is for development. For production you need to create a separate webpack.prod.config.js and pass the const port = (process.env.PORT || 8010) using express .. Here is Boiler Plate react app for making webpack configs which are heroku ready .

Upvotes: 1

Related Questions