forked from NuCivic/react-dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (47 loc) · 1.2 KB
/
webpack.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
var path = require('path');
var webpack = require('webpack');
var indexPath;
console.log("ENV", process.env.REACT_DASH_EX);
// load example based on env set in npm script
switch (process.env.REACT_DASH_EX) {
case 'js_static':
indexPath = './examples/js_static_example/app.js';
break;
case 'jsx_static':
indexPath = './examples/jsx_static_example/app.js';
break;
default:
indexPath = './examples/index.js';
}
console.log('INDEX PATH', indexPath);
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
indexPath
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
include: [
path.join(__dirname, 'src'),
path.join(__dirname, 'examples')
]
},
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, loader: 'file-loader' },
{ test: /\.scss$/, loaders: ['style', 'css', 'sass'] }
]
}
};