-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
build.js
35 lines (31 loc) · 858 Bytes
/
build.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
var fs = require('fs')
var path = require('path')
var browserify = require('browserify')
// output file
var ws = fs.createWriteStream('bundle.js')
// browserify options (mostly to work with Electron)
var opts = {
entries: './index.js',
insertGlobals: true,
ignoreMissing: true,
builtins: false,
browserField: false,
insertGlobalVars: {
'__dirname': (file, basedir) => {
return '__dirname + "/" + ' +
JSON.stringify(path.dirname(path.relative(basedir, file)))
},
'__filename': (file, basedir) => {
return '__dirname + "/" + ' +
JSON.stringify(path.relative(basedir, file))
},
'process': undefined,
'global': undefined,
'Buffer': undefined,
'Buffer.isBuffer': undefined
}
}
browserify(opts)
.transform('sheetify/transform', { use: [ 'sheetify-nested' ] })
.bundle()
.pipe(ws)