Skip to content

Commit e125b99

Browse files
committed
Catch errors in statically evaluated expressions
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 d6660f6 commit e125b99

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
@@ -308,7 +308,11 @@ module.exports = function parse (modules, opts) {
308308
});
309309

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

0 commit comments

Comments
 (0)