Created
January 3, 2017 02:31
-
-
Save dengjonathan/cb294fe3951558d3d1022af2d4efbfe1 to your computer and use it in GitHub Desktop.
This file contains 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
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