-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
62 lines (60 loc) · 1.47 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
52
53
54
55
56
57
58
59
60
61
62
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');
module.exports = function(options) {
var entry = {
main: options.hot ?
[
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'./app/react/index'
]
:
[
'webpack-dev-server/client?http://localhost:8080',
'./app/react/index'
]
};
var extensions = ['', '.js', '.jsx', '.js.jsx'];
var loaders = [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: options.hot ? ['react-hot', 'babel-loader'] : ['babel-loader']
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css!sass')
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('css!sass')
}
];
var output = {
path: __dirname + '/app/assets/javascripts',
filename: 'react_bundle.js',
publicPath: 'http://localhost:8080/'
};
var plugins = [
new ExtractTextPlugin('../stylesheets/react_bundle.css', {
allChunks: true
}),
new webpack.DefinePlugin({
__DEVELOPMENT__: options.development ? true : false,
__DEVTOOLS__: options.debug ? true : false
})
];
return {
entry: entry,
output: output,
module: {
loaders: loaders
},
devtool: options.devtool,
resolve: {
extensions: extensions
},
plugins: plugins
};
}