Deploying with Surge

In notebook:
Building Modern Web Apps
Created at:
2016-02-02
Updated:
2016-02-02
Tags:
libraries JavaScript backend Webpack
Argues that shipping your site to production should be easy (for frontend developers)

You don't even need to set up a server.
He recommends Surge.
An npm installabe cli tool that lets you deploy.

The project is already set up to use the deploy script.
​-d​ flag, ​-p​ flag
then just ​npm run deploy​ 
note: you have to run build first to be able to deploy

We have to configure Surge's wildcard routing (so we don't redirected to a 404 page but let the client-side handle the routing)
you have to create a 200.html to tell Surge to use this. In webpack we have to configure it:
  // ****     webpack.config.js       ****

var getConfig = require('hjs-webpack')

module.exports = getConfig({
    in: 'src/app/js',
    out: 'public'.
    clearBeforBuild: true,
    // ++++ 1. configure what he want to build
    // context = the default layout we were using
    html: function (context) {
        return {
            'index.html': context.defaultTemplate(),
            '200.html': context.defaultTemplate()
        }
    }
})
the 200.html trick won't confuse surge to serve pngs for example (it will 404 if not found)