Skip to content

Commit

Permalink
Exclude Node timers and timers/promises modules from bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Sep 11, 2024
1 parent c7ca525 commit eb65643
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ try {
* @param done
*/
function makeBundle(entryPoint, config, done) {
browserify(entryPoint, config).bundle(function (err, buffer) {
if (err) {
throw err;
}
done(buffer.toString());
});
browserify(entryPoint, config)
.exclude("timers")
.exclude("timers/promises")
.bundle(function (err, buffer) {
if (err) {
throw err;
}
done(buffer.toString());
});
}

makeBundle(
Expand All @@ -45,7 +48,7 @@ makeBundle(
function (bundle) {
var script = preamble + bundle;
fs.writeFileSync("pkg/sinon.js", script); // WebWorker can only load js files
}
},
);

makeBundle(
Expand All @@ -59,7 +62,7 @@ makeBundle(
function (bundle) {
var script = preamble + bundle;
fs.writeFileSync("pkg/sinon-no-sourcemaps.cjs", script);
}
},
);

makeBundle(
Expand All @@ -78,5 +81,5 @@ makeBundle(

var script = preamble + intro + bundle + outro;
fs.writeFileSync("pkg/sinon-esm.js", script);
}
},
);

0 comments on commit eb65643

Please sign in to comment.