hot-reload-server
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -13,45 +13,50 @@ 'use strict' | ||
// Create the webpack compiler | ||
const webpackCompiler = webpack(webpackConfig) | ||
// Create the webpack compiler | ||
const webpackCompiler = webpack(webpackConfig) | ||
// Create the hot reload server | ||
let app = express() | ||
// Create the hot reload server | ||
let app = express() | ||
// Set the address/port | ||
webpackConfig.hotReloadServer = Object.assign({}, { | ||
address: 'localhost', | ||
port: 4000 | ||
}, webpackConfig.hotReloadServer) | ||
// Set the address/port | ||
webpackConfig.hotReloadServer = Object.assign({}, { | ||
address: 'localhost', | ||
port: 4000 | ||
}, webpackConfig.hotReloadServer) | ||
// Set the default webpack-dev-middleware configs | ||
let defaults = { | ||
noInfo: true, | ||
watchOptions: { | ||
aggregateTimeout: 1000, | ||
poll: 1000 | ||
} | ||
} | ||
// Set the default webpack-dev-middleware configs | ||
let defaults = { | ||
noInfo: true, | ||
watchOptions: { | ||
aggregateTimeout: 1000, | ||
poll: 1000 | ||
} | ||
} | ||
return { | ||
start: function() { | ||
// Override webpack-dev-middleware configs | ||
devMiddlewareConfig = Object.assign({}, defaults, devMiddlewareConfig) | ||
return { | ||
// starts the hot-reload-server | ||
start: function() { | ||
// Override webpack-dev-middleware configs | ||
devMiddlewareConfig = Object.assign({}, defaults, devMiddlewareConfig) | ||
// Attach webpack-dev-middleware and webpack-hot-middleware | ||
app.use(webpackDevMiddleware(webpackCompiler, devMiddlewareConfig)) | ||
app.use(webpackHotMiddleware(webpackCompiler)) | ||
// Attach webpack-dev-middleware and webpack-hot-middleware | ||
app.use(webpackDevMiddleware(webpackCompiler, devMiddlewareConfig)) | ||
app.use(webpackHotMiddleware(webpackCompiler)) | ||
// Create static directories | ||
app.use(path.basename(webpackConfig.output.path), express.static(webpackConfig.output.path)) | ||
// Create static directories | ||
app.use(path.basename(webpackConfig.output.path), express.static(webpackConfig.output.path)) | ||
// Listen to the port | ||
let server = app.listen(webpackConfig.hotReloadServer.port, function(err, result) { | ||
if (err) { | ||
console.log(err) | ||
} | ||
console.log('hot-reload-server running on http://%s:%s', webpackConfig.hotReloadServer.address, webpackConfig.hotReloadServer.port) | ||
}) | ||
} | ||
} | ||
// Listen to the port | ||
let server = app.listen(webpackConfig.hotReloadServer.port, function(err, result) { | ||
if (err) { | ||
console.log(err) | ||
} | ||
console.log('hot-reload-server running on http://%s:%s', webpackConfig.hotReloadServer.address, webpackConfig.hotReloadServer.port) | ||
}) | ||
}, | ||
// retrieves the express app instance | ||
get: function() { | ||
return app | ||
} | ||
} | ||
} |
{ | ||
"name": "hot-reload-server", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "hot-reload-server.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4793
79