chore(build): exclude 'fs' from build via pkg.json browser field

BREAKING CHANGE:

This commit requires that you upgrade your browserify version to >=
3.44.0.
This commit is contained in:
Nico Rehwaldt 2014-04-25 13:28:40 +02:00
parent a842ee80a6
commit 0878841b0f
2 changed files with 6 additions and 19 deletions

View File

@ -66,29 +66,13 @@ module.exports = function(grunt) {
},
browserify: {
options: {
transform: [ 'brfs', function() {
// remove require('fs') from source code as it is
// optimized away (i.e. inlined) by brfs transform
var through = require('through');
var data = '';
return through(write, end);
function write (buf) { data += buf; }
function end () {
this.queue(data.replace(/require\('fs'\)/, '{}'));
this.queue(null);
}
}],
transform: [ 'brfs' ],
browserifyOptions: {
builtins: false,
builtins: [ 'fs' ],
commondir: false
},
bundleOptions: {
detectGlobals: false,
ignoreMissing: true,
insertGlobalVars: [],
debug: true
}

View File

@ -22,6 +22,9 @@
"name": "Nico Rehwaldt",
"url": "https://github.com/Nikku"
},
"browser": {
"fs": false
},
"contributors": [
{
"name": "bpmn.io contributors",