-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
82 lines (80 loc) · 1.97 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
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const path = require('path')
const debug = process.argv.indexOf('-d') >= 0 ||
process.argv.indexOf('--debug') >= 0
module.exports = {
cache: true,
context: path.join(__dirname, 'src'),
entry: {
client: [
'whatwg-fetch',
'eventsource-polyfill',
'./client-client.js'
]
},
module: {
loaders: [
{
test: /\.json$/i,
loader: 'json'
},
{
test: /\.css$/i,
loader: ExtractTextPlugin.extract('style', 'css!postcss')
},
{
test: /\.less$/i,
loader: ExtractTextPlugin.extract('style', 'css!less')
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
loader: 'url?limit=10000&name=img/[name].[ext]'
}
]
},
output: {
filename: '[name].js',
chunkFilename: '[name].js',
path: path.join(__dirname, 'dist'),
publicPath: '/'
},
devtool: debug ? 'eval-source-map' : 'source-map',
plugins: [
new ExtractTextPlugin('[name].css'),
new webpack.DefinePlugin({
'process.env': {
// This has effect on the react lib size
NODE_ENV: debug ? '"development"' : '"production"'
}
})
].concat(!debug ? [] : [
new webpack.optimize.DedupePlugin()/*,
new webpack.optimize.UglifyJsPlugin({ // doesn't support ES6 yet :(
compress: {
screw_ie8: true, // please don't use IE8
unsafe: true,
warnings: false // don't puke warnings when you drop code
},
mangle: {
screw_ie8: true
}
}) */
]),
postcss: function (webpack) {
return [
require('postcss-import')({
addDependencyTo: webpack,
path: [ 'lib' ]
}),
require('postcss-url')({
url: 'rebase'
}),
require('postcss-cssnext')({
browsers: [ 'last 2 versions' ]
}),
require('postcss-browser-reporter')(),
require('postcss-reporter')()
]
}
}