-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·28 lines (22 loc) · 735 Bytes
/
build
File metadata and controls
executable file
·28 lines (22 loc) · 735 Bytes
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
#!/usr/bin/env node
var browserify = require('browserify')
var fs = require('fs')
var path = require('path')
var entries = [
path.join(__dirname, 'index.js')
]
var outputFiles = [
path.join(__dirname, 'dist-main.js')
]
var b = browserify(entries)
b.plugin('factor-bundle', {
output: outputFiles,
threshold: function (row, groups) {
// Get a relative directory to where we are building
var rPath = path.relative(__dirname, row.file)
// Assuming our node_modules folder is in the same directory that we are
// building in then just declare vendor files as those presiding in it
return !!rPath.match(/^node_modules\//)
}
})
b.bundle().pipe(fs.createWriteStream(path.join(__dirname, 'dist-vendor.js')))