File size: 520 Bytes
d86254c
 
 
 
3f0c832
c766f4e
d86254c
 
17851f6
d86254c
17851f6
d86254c
17851f6
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const opn = require('opn');

const config = require('./config/webpack.config.demo');

const PORT = 3000;
const HOST = 'localhost';
const URL = `http://${HOST}:${PORT}`;

config.entry.unshift(`webpack-dev-server/client?${URL}`);

new WebpackDevServer(webpack(config))
  .listen(PORT, HOST, (error) => {
    if (error) {
      console.error(error);
      return;
    }

    opn(URL);
    console.log(`Listening at ${URL}`);
  });