-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
93 lines (91 loc) · 2.04 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
84
85
86
87
88
89
90
91
92
93
var path = require('path');
var webpack = require('webpack');
var join = path.join;
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
var plugins = [
new webpack.ProvidePlugin({
JSON: 'JSON',
$: 'jquery',
jQuery: 'jquery',
moment: 'moment-timezone',
'window.jquery': 'jquery',
'Backbone.Validation': 'backbone-validation',
Mustache: 'mustache',
'_': 'lodash',
Backbone: 'backbone',
Pikaday: 'pikaday',
Waypoint: 'waypoints',
'global.moment': 'moment-timezone',
'global._': 'lodash',
'global.Backbone': 'backbone',
'global.Mustache': 'mustache',
'global.Pikaday': 'pikaday',
'global.Waypoint': 'waypoints'
}),
new webpack.ResolverPlugin([
new webpack.ResolverPlugin.FileAppendPlugin(['/src/waypoint.js'])
]),
new CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js',
minChunks: 0
})
];
module.exports = {
entry: {
vendor: [
'jquery',
'jquery.cookie',
'console-polyfill',
'es5-shim',
'json3',
'mustache',
'moment-timezone',
'lodash',
'backbone',
'backbone-validation',
'pikaday',
'waypoints'
],
moment: './src/moment.js',
mustache: './src/mustache.js',
lodash: './src/lodash.js',
backbone: './src/backbone.js',
pikaday: './src/pikaday.js',
waypoints: './src/waypoints.js'
},
output: {
path: join(__dirname, 'dist'),
filename: '[name].js'
},
externals: {
jquery: 'jQuery',
JSON: 'JSON'
},
resolve: {
alias: {
underscore: 'lodash'
}
},
module: {
loaders: [
{
test: /node_modules\/waypoints\//,
loader: 'imports?window=>{}!exports?window.Waypoint'
},
{
test: require.resolve('backbone'),
loader: 'expose?Backbone'
},
{
test: require.resolve('backbone-validation'),
loader: 'expose?Backbone.Validation'
},
{
test: /\.json$/,
loader: 'json'
}
]
},
plugins: plugins
};