forked from AllenFang/react-bootstrap-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.example.config.js
61 lines (58 loc) · 1.49 KB
/
webpack.example.config.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// this will build and serve the examples
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
app: [
'react-hot-loader/patch',
'./examples/js/app.js'
],
vendors: [ 'webpack-dev-server/client?http://localhost:3004', 'webpack/hot/only-dev-server' ]
},
debug: true,
devtool: '#eval-source-map',
output: {
path: path.join(__dirname, 'examples'),
filename: '[name].bundle.js'
},
serverConfig: {
port: '3004',// server port
publicPath: '/',// js path
contentBase: 'examples/'// web root path
},
resolve: {
extensions: [ '', '.js', '.jsx' ],
alias: {
'react-bootstrap-table': path.resolve(__dirname, './src')
}
},
module: {
preLoaders: [
{
test: /\.js$/,
exclude: [ /node_modules/, path.resolve(__dirname, './src/filesaver.js') ],
loader: 'eslint'
}
],
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel']
}, {
test: /\.css$/, loader: 'style-loader!css-loader'
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.ProgressPlugin(function(percentage, message) {
const percent = Math.round(percentage * 100);
process.stderr.clearLine();
process.stderr.cursorTo(0);
process.stderr.write(percent + '% ' + message);
})
]
};