-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (23 loc) · 1.02 KB
/
server.js
File metadata and controls
27 lines (23 loc) · 1.02 KB
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
const webpack = require('webpack');
const openBrowser = require('react-dev-utils/openBrowser');
// const internalIP = require('internal-ip');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./tools/webpack.config.base');
const compiler = webpack(config);
const portal = config.devServer.https ? 'https' : 'http';
const port = config.devServer.port;
const ip = config.devServer.host || '127.0.0.1';
// for (let key in config.entry) {
// const arr = config.entry[key];
// if (key !== 'common') {
// arr.unshift('webpack-dev-server/client?' + portal + '://' + ip + ':' + port + '/', 'webpack/hot/dev-server');
// }
// }
// config.plugins = config.plugins || [];
// config.plugins.push(new webpack.HotModuleReplacementPlugin());
// config.plugins.push(new webpack.NamedModulesPlugin());
new WebpackDevServer(config.devServer, compiler).startCallback(() => {
console.log(`Listening at localhost: ${port}`);
console.log('Opening your system browser...');
openBrowser(`${portal}://${ip}:${port}`);
});