-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
80 lines (70 loc) · 1.92 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
/* @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later */
'use strict';
var path = require('path');
var webpack = require('webpack');
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
var htmlWebpackPlugin = require('html-webpack-plugin');
var CordovaPlugin = require('webpack-cordova-plugin');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var useCordova = (function() {
var tmp = parseInt(process.env.BUILD_CORDOVA);
return isNaN(tmp) ? false : tmp !== 0; // fsck JS
})();
module.exports = {
resolve: {
root: [
path.join(__dirname, 'node_modules'),
path.join(__dirname, "bower_components"),
]
},
plugins: [
new webpack.ExtendedAPIPlugin(),
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
),
new ngAnnotatePlugin({
add: true
}),
new htmlWebpackPlugin({
template: 'public/lovecall.html',
hash: true,
inject: 'body',
minify: {
removeComments: true,
collapseWhitespace: true,
caseSensitive: true,
},
}),
],
devServer: {
contentBase: './build',
},
entry: "./src/js/main.js",
output: {
path: path.join(__dirname, 'build'),
filename: "assets/bundle.js",
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css!postcss" },
{ test: /\.tmpl\.html$/, loader: "ng-cache?-conservativeCollapse&-preserveLineBreaks" },
{ test: /\.(jpg|png|woff|woff2|eot|ttf|svg|opus)$/, loader: 'url-loader?limit=100000' },
]
},
postcss: function() {
return [autoprefixer, precss];
}
};
if (useCordova) {
module.exports.plugins.push(
new CordovaPlugin({
config: 'config.xml',
src: 'index.html',
platform: 'android',
version: true,
})
);
}
/* @license-end */
// vim:set ai et ts=2 sw=2 sts=2 fenc=utf-8: