Skip to content

Commit df3233c

Browse files
Catch errors in statically evaluated expressions (#39)
This will just not replace expressions that cannot be evaluated because of a runtime error. This is needed for browserify/brfs#83 which fixes browserify/brfs#81.
1 parent 1f20520 commit df3233c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ module.exports = function parse (modules, opts) {
309309
});
310310

311311
if (callee !== undefined) {
312-
res = callee.apply(null, args);
312+
try {
313+
res = callee.apply(null, args);
314+
} catch (err) {
315+
// Evaluate to undefined
316+
}
313317
}
314318
}
315319

0 commit comments

Comments
 (0)