@clinic/clinic-common
Version:
Shared parts between the Clinic.js suite
27 lines (22 loc) • 504 B
JavaScript
const browserify = require('browserify')
const brfs = require('brfs')
const envify = require('loose-envify/custom')
const buildJs = ({ basedir, debug, fakeDataPath, scriptPath, beforeBundle, env = {} }) => {
const b = browserify({
basedir,
debug,
noParse: [fakeDataPath]
})
if (beforeBundle) {
beforeBundle(b)
}
return b
.add(scriptPath)
.transform(brfs)
.transform(envify({
DEBUG_MODE: debug,
...env
}))
.bundle()
}
module.exports = buildJs