-
Notifications
You must be signed in to change notification settings - Fork 36
/
webpack.config.js
56 lines (45 loc) · 1.36 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
var webpack = require("webpack");
var glob = require("glob")
var path = require("path");
var staticPath = path.join(__dirname , "static");
var array = glob.sync( "static/**/load.*.js") ;
var entryMap = {};
for(var i = 0 ; i <array.length ; i ++){
var filePath = array[i];
var entryName = filePath.match(/load\.(.+)\.js/i , filePath )[1];
entryMap["entry." + entryName + ""] = filePath.replace("static" , ".");
}
entryMap["common"] = [
"underscore" ,
"./lib/underscore/underscore.ext" ,
"jquery",
"expose?moment!moment",
"./lib/bootstrap/bootstrap",
"./lib/bootstrap/bootstrap-datetimepicker.min"
]
module.exports = {
context: staticPath,
entry: entryMap,
output: {
path: path.join(__dirname , "static"),
filename: './[name].js'
},
resolve: {
modulesDirectories : [ 'node_modules' , path.join( __dirname, "static/common" ) , path.join( __dirname, "static/lib" ) , staticPath]
},
module : {
loaders: [
{ test: /\.css/, loader: "css!style" },
{ test: /\.ejs/, loader: "ejs" },
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin( 'common' , 'common.js' ) ,
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
_: 'underscore'
})
]
};