forked from vrathee/redhat_access_pcm_ascension_common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
81 lines (77 loc) · 2.39 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
'use strict';
var webpack = require('webpack');
var path = require('path');
module.exports = function (options) {
var config = {
entry: './app/common/main.module.js',
output: {
filename: options.filename
// libraryTarget: 'umd',
// library: 'uds'
},
module: {
loaders: [
{
test: /[\/]angular\.js$/, loader: "exports?angular"
},
{
test: /\.js$/,
loader: 'ng-annotate?add=true!babel',
exclude: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'bower_components')
]
},
{
test: /\.css$/,
loader: 'style!css?minimize'
},
// https://github.com/tcoopman/image-webpack-loader
{
test: /\.(jpe?g|png|gif|svg)/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
{
test: /\.(woff|woff2)/,
loader: 'url-loader?limit=10000'
},
{
test: /\.(ttf|eot)/,
loader: 'file-loader'
},
{
// HTML LOADER
// Reference: https://github.com/webpack/raw-loader
// Allow loading html through js
test: /\.html$/,
loader: 'raw'
},
{
test: /\.jade$/,
loader: 'babel!jade'
}
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
]
};
if (options.minified) {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
)
}
return config;
};