forked from formly-js/angular-formly-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
75 lines (66 loc) · 1.94 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
var path = require('path');
var fs = require('fs');
var webpack = require('webpack');
var _ = require('lodash');
var dev = process.env.NODE_ENV !== 'production';
module.exports = {
entry: './app',
output: {
filename: 'bundle.js',
path: __dirname
},
stats: {
colors: true,
reasons: true
},
devtool: dev ? 'eval' : null,
plugins: _.filter(_.union([
new webpack.DefinePlugin({
ON_DEV: dev
})
], dev ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
])),
resolve: {
extensions: ['', '.js'],
modulesDirectories: ['shared', 'node_modules', 'bower_components'],
alias: {
// sadly have to do this because formly's trying to load it's version of angular
// which is different from the one in the demo folder... Nesting with node_modules
// and requiring files outside of this is a little odd...
// Nobody else will have to do this!
angular: path.join(__dirname, '/node_modules/angular/angular'),
stateUtils: path.join(__dirname, '/app/shared/ngCommon/services/stateUtils')
}
},
module: {
loaders: [
{test: /\.css$/, loader: 'style!css!postcss'},
{test: /\.html$/, loader: 'raw', exclude: /node_modules/},
{test: /\.md$/, loader: 'html!markdown'},
{test: /\.json$/, loader: 'json'},
{test: /\.png$/, loader: 'url?mimetype=image/png'},
{test: /\.js$/, loader: 'ng-annotate!babel!jshint', exclude: /node_modules/},
{
test: /\.(woff|woff2|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader?name=res/[name].[ext]?[hash]'
}
]
},
jshint: {
failOnHint: true,
emitErrors: true
},
postcss: [
require('postcss-nested'),
require('autoprefixer-core'),
require('csswring')
]
};