Skip to content

Instantly share code, notes, and snippets.

@dengjonathan
Created January 3, 2017 02:31
Show Gist options
  • Save dengjonathan/cb294fe3951558d3d1022af2d4efbfe1 to your computer and use it in GitHub Desktop.
Save dengjonathan/cb294fe3951558d3d1022af2d4efbfe1 to your computer and use it in GitHub Desktop.
const Server = require('./server.js');
const webpack = require('webpack');
let config;
const port = (process.env.PORT || 8080);
const app = Server.app();
if (process.env.NODE_ENV === 'development') {
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
config = require('../webpack.config.js');
app.use(webpackHotMiddleware(compiler))
app.use(webpackDevMiddleware(compiler, {
noInfo: true,
publicPath: config.output.publicPathdist
}))
} else {
config = require('../webpack.deployment.config.js');
}
const compiler = webpack(config);
app.listen(port);
console.log(`Listening at http://localhost:${port}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment