-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
77 lines (76 loc) · 2.48 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var webpack = require('webpack'),
autoprefixer = require('autoprefixer'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
path = require('path')
module.exports = {
context: path.join(__dirname, './src'),
entry: {
app: './index.jsx',
lib: [
'react',
'react-dom',
'react-redux',
'react-router',
'react-router-redux',
'redux'
]
},
output: {
path: path.join(__dirname, './dist'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.scss$/,
loader: 'style-loader!css-loader?modules&camelCase&importLoaders=1&localIdentName=[local]__[hash:base64:5]!postcss-loader!sass-loader'
},
{
test: /\.css$/,
exclude: path.resolve(__dirname, './src'),
loader: 'style-loader!css-loader?camelCase&importLoaders=1&localIdentName=[local]__[hash:base64:5]!postcss-loader'
},
{
test: /\.css$/,
include: path.resolve(__dirname, './src'),
loader: 'style-loader!css-loader?modules&camelCase&importLoaders=1&localIdentName=[local]__[hash:base64:5]!postcss-loader'
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: [
'react-hot',
'babel-loader'
]
},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.tpl$/, loader: 'html-tpl?minimize=false&collapseWhitespace=false'},
{test: /\.(png|jpg|gif)$/, loader: 'url-loader?limit=8192&name=[name]_[hash:5].[ext]'}
]
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
'react': path.join(__dirname, 'node_modules', 'react')
}
},
postcss: [
autoprefixer({
browsers: [ 'Android >= 4', 'iOS > 6', 'last 10 Chrome versions', 'last 4 Firefox versions', 'Safari >= 6', 'ie > 8' ]
})
],
plugins: [
new webpack.optimize.CommonsChunkPlugin('lib', 'lib.js'),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development') }
}),
new HtmlWebpackPlugin({
template: './index.html'
})
],
devServer: {
stats: { chunks:false },
contentBase: './src',
hot: true
}
}