/
webpack.js
95 lines (90 loc) · 1.97 KB
/
webpack.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
89
90
91
92
93
94
95
import path from './path'
import NODE_ENV from 'node-env'
import webpack from 'webpack'
import ProgressPlugin from '../src/webpack-progress'
let config = {
context: path('src'),
resolve: {
alias: {
bemuse: path('src'),
assets: path('assets'),
},
},
resolveLoader: {
alias: {
bemuse: path('src'),
},
},
entry: {
boot: './boot'
},
devtool: 'source-map',
output: {
path: path('dist', 'build'),
publicPath: 'build/',
filename: '[name].js',
chunkFilename: '[name]-[chunkhash].js',
},
devServer: {
contentBase: false,
publicPath: '/build/',
stats: { colors: true },
},
module: {
loaders: [
{
test: /\.js$/,
include: [path('src'), path('spec')],
loader: 'babel?modules=common&experimental=true',
},
{
test: /\.pegjs/,
loader: 'pegjs',
},
{
test: /\.scss$/,
loader: 'style!css!autoprefixer?browsers=last 2 version' +
'!sass?outputStyle=expanded',
},
{
test: /\.css$/,
loader: 'style!css!autoprefixer?browsers=last 2 version',
},
{
test: /\.jade/,
loader: 'jade',
},
{
test: /\.png$/,
loader: 'url-loader?limit=100000&mimetype=image/png',
},
{
test: /\.jpg$/,
loader: 'file-loader',
},
],
postLoaders: [],
},
plugins: [
new ProgressPlugin(),
],
}
if (NODE_ENV === 'test' || process.env.COV === 'true') {
config.module.postLoaders.push({
test: /\.js$/,
include: [path('src')],
exclude: [
path('src', 'test'),
path('src', 'polyfill'),
path('src', 'boot', 'loader.js'),
],
loader: 'istanbul-instrumenter!bemuse/webpack-istanbul-babel-skipper',
})
}
if (NODE_ENV === 'production') {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.OccurenceOrderPlugin()
)
}
export default config