This repository has been archived by the owner on Jul 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
83 lines (80 loc) · 1.91 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
83
/* eslint-env node */
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var root = __dirname;
// var node = path.resolve(root, 'node_modles');
var src = path.resolve(root, 'src');
var dist = path.resolve(root + '/www');
var build = {
prod: false
};
module.exports = {
entry: {
vendors: [
'ionic',
'angular',
'angular-animate',
'angular-sanitize',
'angular-ui-router',
'ionic-angular',
'ng-cordova',
'lodash'
],
polyfill: 'babel-polyfill',
bundle: path.resolve(src, 'index.js')
},
debug: true,
eslint: {
configFile: path.resolve(root, '.eslintrc')
},
module: {
loaders: [{
test: /\.js$/,
exclude: [path.resolve(root, 'node_modules')],
loaders: [
'babel'
]
}, {
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
}, {
test: /\.woff/,
loader: 'url?prefix=font/&limit=10000&mimetype=application/font-woff'
}, {
test: /\.ttf/,
loader: 'file?prefix=font/'
}, {
test: /\.eot/,
loader: 'file?prefix=font/'
}, {
test: /\.svg/,
loader: 'file?prefix=font/'
}, {
test: /\.html$/,
loaders: [
'html'
]
}]
},
output: {
filename: ((build.prod) ? 'js/[name].[chunkhash].js' : 'js/[name].js'),
path: dist,
hash: 'chunk'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendors', ((build.prod) ? 'js/vendors.[chunkhash].js' : 'js/vendors.js')),
new HtmlWebpackPlugin({
pkg: require('./package.json'),
template: 'src/index.htm',
filename: 'index.html',
inject: false
})
],
resolve: {
alias: { // If the the key ends with $ only the exact match (without the $) will be replaced.
'ionic': 'ionic-sdk/release/js/ionic.js',
'ionic-angular': 'ionic-sdk/release/js/ionic-angular.js'
}
}
};