-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch-app.js
30 lines (25 loc) · 907 Bytes
/
launch-app.js
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
28
29
30
#!/usr/bin/env node
const Webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const webpackConfig = require('./webpack.dev');
const path = require('path');
var port = process.argv[2] ? (process.argv[2].split('=')[1] ? process.argv[2].split('=')[1] : 8080) : 8080;
const compiler = Webpack(webpackConfig({}, { mode:'development', port}));
const server = new WebpackDevServer(compiler, {
contentBase: [ path.resolve(__dirname + `../../../public`) ],
disableHostCheck: true,
historyApiFallback: {
index: 'index.html'
},
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
},
inline: true,
watchOptions: {
poll: true
}
});
server.listen(port, 'localhost', () => {
console.log(`Starting server on http://localhost:${port}`);
});