-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbrowserify.js
executable file
·76 lines (58 loc) · 1.27 KB
/
browserify.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
'use strict';
var babelify = require('babelify'),
config = require('./config'),
glob = require('glob');
var BUNDLE_CLASSES;
BUNDLE_CLASSES = [];
Object.keys(config.jsPath).forEach(function (path) {
var files,
pattern;
pattern = config.jsPath[path];
if (pattern) {
path = path + '/';
files = glob.sync(path + pattern);
files.forEach(function (file) {
var alias;
alias = file.replace(path, '').replace('.js', '');
BUNDLE_CLASSES.push('./' + file + ':' + alias);
});
}
});
var browserify = {
options: {
browserifyOptions: {
debug: true,
paths: Object.keys(config.jsPath)
},
transform: [
babelify.configure({
presets: ['es2015']
})
]
},
'bundle': {
src: [],
dest: config.build + '/' + config.src + '/htdocs/js/bundle.js',
options: {
alias: BUNDLE_CLASSES
}
},
'entrypoints': {
expand: true,
cwd: './' + config.src + '/htdocs/js',
dest: './' + config.build + '/' + config.src + '/htdocs/js',
src: [
'*.js'
],
options: {
}
},
'test': {
src: config.test + '/test.js',
dest: config.build + '/' + config.test + '/test.js',
options: {
external: BUNDLE_CLASSES
}
}
};
module.exports = browserify;