mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
cb31dbc75c
In https://github.com/angular/angular/pull/49144 we introduced a change to only path `Promise.prototype.then` due to Node.js `SafePromise` complaining about `Promise.prototype.then` called on incompatible receiver. This however introduced a number of regressions. This commit reverts this change and re-introduces the changes to patch the entire promise on Node. The original `SafePromise` problem is no longer reproducible as of Node.js version 18.13+ as it was addressed as part of https://github.com/nodejs/node/pull/45175. While the Angular CLI does not yet generate ESM server bundles, users using ESM with dynamic imports will require using Node.js 18.13 or later. Closes #50513, closes #50457, closes #50414 and closes #49930 PR Close #50552
22 lines
444 B
JavaScript
22 lines
444 B
JavaScript
import '../../build/zone.umd.js';
|
|
|
|
Zone[Zone.__symbol__('ignoreConsoleErrorUncaughtError')] = true;
|
|
const deferred = function () {
|
|
const p = {};
|
|
p.promise = new Promise((resolve, reject) => {
|
|
p.resolve = resolve;
|
|
p.reject = reject;
|
|
});
|
|
return p;
|
|
};
|
|
|
|
const resolved = (val) => {
|
|
return Promise.resolve(val);
|
|
};
|
|
|
|
const rejected = (reason) => {
|
|
return Promise.reject(reason);
|
|
};
|
|
|
|
export default {deferred, resolved, rejected};
|