Created
February 19, 2015 13:55
-
-
Save bebraw/40c52b65ae5a1100c53f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var express = require('express'); | |
var webpack = require('webpack'); | |
var webpackDevMiddleware = require('webpack-dev-middleware'); | |
var config = require('./config/webpack.config'); | |
main(); | |
function main() { | |
var port = 4000; | |
var ip = '0.0.0.0'; | |
var app = express(); | |
app.use(webpackDevMiddleware(webpack(config), { | |
publicPath: config.output.publicPath, | |
hot: true, | |
stats: { | |
color: true | |
}, | |
})); | |
// XXX: matches too much? how about socket.io? | |
app.get('/*', function(req, res) { | |
res.sendFile(__dirname + '/index.html'); | |
}); | |
app.listen(port, ip, function(err) { | |
if(err) { | |
return console.error(err); | |
} | |
console.log('Listening at ' + ip + ':' + port); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is that this yields
XMLHttpRequest cannot load http://0.0.0.0:4000/socket.io/1/?t=1424354024912. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4000' is therefore not allowed access.
so hot loading doesn't work. Maybe/*
matches a bit too much?