From 0878841b0f6a5813e3ed4f066a3cce1437c0526e Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 25 Apr 2014 13:28:40 +0200 Subject: [PATCH] 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. --- Gruntfile.js | 22 +++------------------- package.json | 3 +++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7c72b9a1..16f2b91a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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 } @@ -216,7 +200,7 @@ module.exports = function(grunt) { }); // tasks - + grunt.registerTask('test', [ 'jasmine_node', 'karma:single' ]); grunt.registerTask('build', function(target, mode) { diff --git a/package.json b/package.json index 3341ac81..629aefcd 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "name": "Nico Rehwaldt", "url": "https://github.com/Nikku" }, + "browser": { + "fs": false + }, "contributors": [ { "name": "bpmn.io contributors",