forked from adazzle/react-data-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-dev-server.js
41 lines (36 loc) · 1.05 KB
/
webpack-dev-server.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
31
32
33
34
35
36
37
38
39
40
41
const webpackCommon = require('./config/webpack.common.config');
const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const specificConfig = {
entry: {
index: ['./packages/react-data-grid-examples/src']
},
output: {
path: '/packages/react-data-grid-examples/src/',
filename: '[name].js',
library: ['ReactDataGrid'],
libraryTarget: 'umd'
},
externals: {
react: 'React',
'react/addons': 'React',
'react-dom': 'ReactDOM',
faker: 'faker',
moment: 'moment'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
};
const config = Object.assign({ }, webpackCommon, specificConfig);
config.entry.index.unshift('webpack-dev-server/client?http://localhost:8080/', 'webpack/hot/dev-server');
const compiler = webpack(config);
const server = new WebpackDevServer(compiler, {
hot: true,
open: true,
contentBase: 'packages/react-data-grid-examples/src'
});
server.listen(8080, () => {
const open = require('open');
open('http://localhost:8080/webpack-dev-server/');
});