-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
88 lines (86 loc) · 2.12 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
78
79
80
81
82
83
84
85
86
87
88
var webpack = require('webpack');
var htmlWebpackPlugn = require('html-webpack-plugin');
var path = require('path');
module.exports = {
entry: {
vendor: ['react', 'react-dom', 'redux', 'react-redux', 'react-router', 'history/lib/createHashHistory', 'react-addons-css-transition-group', 'redux-simple-router', 'es6-promise', 'fetch-ie8'],
bundle: './src/index.js'
},
output: {
path: './dist/',
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.css$/,
loaders: ['style', 'css', 'autoprefixer?{browsers: ["last 2 version", "firefox 15", "> 1%"]}'],
exclude: './node_modules/'
},
{
test: /\.less$/,
loaders: ['style', 'css', 'autoprefixer?{browsers: ["last 2 version", "firefox 15", "> 1%"]}', 'less'],
exclude: './node_modules/'
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'autoprefixer?{browsers: ["last 2 version", "firefox 15", "> 1%"]}', 'sass'],
exclude: './node_modules/'
},
{
test: /\.js$/,
loaders: ["react-hot", "babel?presets[]=es2015&presets[]=react&presets[]=stage-0&plugins[]=transform-runtime&plugins[]=add-module-exports"],
exclude: "/node_modules/",
include: path.resolve(__dirname, "src")
},
{
test: /\.(png|jpg|jpeg)$/,
loader: 'url?limit=10000'
},
{
test: /\.woff(2)?(.+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff"
},
{
test: /\.(ttf|eot|svg|gif|ico)(.+)?$/,
loader: "file"
},
{
test: /\.json$/,
loader: "json"
}
],
postLoaders: [
{
test: /\.js$/,
loaders: ['es3ify-loader']
}
]
},
resolve: {
extensions: ['', '.js', '.css', '.jsx', '.less', '.scss', 'json']
},
devServer: {
proxy: {
'*':{
target: 'http://localhost:8000',
secure: false
}
},
host: '0.0.0.0',
port: 3000,
hot: true,
inline: true,
config: 'webpack.config.js'
},
devtool: 'source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),
new htmlWebpackPlugn({
template: './src/template.html',
filename: '../index.html',
chunks: ['vendor', 'bundle']
})
]
};