While working on CJS bundles we've decided to duplicate facades code in each and every bundle. This means that if multiple bundles are loaded on the same page (say, core and http) we are executing code contained in facades twice. But it turns out that we've got a piece of code in facade/lang.ts that leads to
RangeError: Maximum call stack size exceeded errors. The culprit is here:
var assertionsEnabled_ = typeof _global['assert'] !== 'undefined';
export function assertionsEnabled(): boolean {
return assertionsEnabled_;
}
// TODO: remove calls to assert in production environment
// Note: Can't just export this and import in in other files
// as `assert` is a reserved keyword in Dart
_global.assert = function assert(condition) {
if (assertionsEnabled_) {
_global['assert'].call(condition);
}
};
This blocks #4278