forked from wayfair-archive/tungstenjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.standalone.js
55 lines (52 loc) · 1.17 KB
/
webpack.standalone.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
var webpack = require('webpack');
var webpackSettings = require('./webpack-helper');
var path = require('path');
function processArg(arg) {
var parts = arg.split('=');
var data = {
name: parts[0]
};
if (parts[1]) {
data.value = parts[1];
}
return data;
}
function processArgs() {
var argData = {};
var args = process.argv;
for (var i = 0; i < args.length; i++) {
// Only process flags
if (args[i] && args[i].substr(0, 1) === '-') {
var arg = processArg(args[i]);
argData[arg.name] = arg.value;
}
}
return argData;
}
var args = processArgs();
// set adaptor with --adaptor=adaptor_name
// default is backbone
var adaptor = args['--adaptor'] || 'backbone';
module.exports = webpackSettings.compileSource({
entry: './adaptors/' + adaptor,
output: {
filename: './dist/tungsten.' + adaptor + '.js',
libraryTarget: 'umd',
library: 'tungsten'
},
resolve: {
alias: {
jquery: path.join(__dirname, './src/polyfill/jquery')
}
},
externals: [
{underscore: 'var window._'},
{lodash: 'var window._'}
],
resolveLoader: {
modulesDirectories: ['node_modules']
},
module: {
loaders: []
}
});