-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (22 loc) · 736 Bytes
/
server.js
File metadata and controls
27 lines (22 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var webpack = require('webpack')
var WebpackDevServer = require('webpack-dev-server')
var config = require('./webpack.config')
var component_to_render = process.argv[2]
var sourcePath = process.argv[3]
if (component_to_render === undefined) {
throw new Error('You need to specify which component to render!')
}
if (sourcePath === undefined) {
throw new Error('You need to specify the source path!')
}
var webConfig = config(component_to_render, sourcePath)
new WebpackDevServer(webpack(webConfig), {
publicPath: webConfig.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(3000, 'localhost', function(err, result) {
if (err) {
return console.log(err)
}
console.log('Listening at http://localhost:3000/')
})