-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.development.js
78 lines (73 loc) · 2.14 KB
/
webpack.development.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')
var path = require('path')
var rucksack = require('rucksack-css')
var autoprefixer = require('autoprefixer')
var includes = [
path.resolve(__dirname, 'app'),
path.resolve(__dirname, 'platforms')
]
module.exports = {
name: 'backend dev hot middlware',
entry: [
// For old browsers
'eventsource-polyfill',
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000',
'./platforms/browser/index.js'
],
output: {
path: path.join(__dirname, '/public/static'),
filename: '[name].js',
chunkFilename: '[id].chunk.js',
publicPath: '/build/'
},
resolve: {
modulesDirectories: ['node_modules', path.join(__dirname, '/node_modules')],
extensions: ['', '.js', '.jsx']
},
resolveLoader: {
modulesDirectories: ['node_modules', path.join(__dirname, '/node_modules')]
},
module: {
loaders: [
{
test: /\.jsx|.js$/,
exclude: /node_modules/,
include: includes,
loader: 'babel-loader',
query: {
presets: ['react-hmre'],
plugins: [
["inline-replace-variables", {
"__SERVER__": false
}]
]
}
}, {
test: /\.css$/,
loader: 'style!css!postcss'
}, {
test: /\.less$/,
include: includes,
loader: 'style!css!less!postcss'
},
{ test: /\.woff2?$/, loader: 'url?limit=10000&minetype=application/font-woff' },
{ test: /\.ttf$/, loader: 'url?limit=10000&minetype=application/octet-stream' },
{ test: /\.eot$/, loader: 'file' },
{ test: /\.svg$/, loader: 'url?limit=10000&minetype=image/svg+xml' },
{ test: /\.(png|jpg|jpeg|gif)$/i, loader: 'url?limit=10000&name=[name].[ext]' },
{ test: /\.json$/, loader: 'json' },
{ test: /\.html?$/, loader: 'file?name=[name].[ext]' }
]
},
postcss: [
rucksack(),
autoprefixer({
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8']
})
],
plugins: [
new webpack.optimize.CommonsChunkPlugin('common', 'common.js'),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin()
]
}