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:
parent
a842ee80a6
commit
0878841b0f
22
Gruntfile.js
22
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) {
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
"name": "Nico Rehwaldt",
|
||||
"url": "https://github.com/Nikku"
|
||||
},
|
||||
"browser": {
|
||||
"fs": false
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "bpmn.io contributors",
|
||||
|
|
Loading…
Reference in New Issue