Hello, I am getting this error since we upgraded to Angular 21:
Uncaught Error: application 'smc-mf-content' died in status SKIP_BECAUSE_BROKEN: single-spa-angular: the options.bootstrapFunction must return a promise, but instead returned a 'object' that is not a Promise
at mount (single-spa-community-angular.mjs:206:15)
at lifecycle.helpers.js:28:29
It seems to come from this line:
if (!(bootstrapPromise instanceof Promise)) {
We did not have it before, so I am thinking that probably something internal in Angular changed that impacts the bundling. We use the Angular application builder (esbuild). Or maybe it's because we "externalize" single-spa via our importmap? (but we were doing that already before...)
In any case, I took a look at what single-spa itself is doing internally and I believe that implementation is a bit more robust:
export function smellsLikeAPromise(promise) {
return (
promise &&
typeof promise.then === "function" &&
typeof promise.catch === "function"
);
}
I have tried patching single-spa-angular with this smellsLikeAPromise approach (instead of instanceof Promise) and that works like a charm for us.
Would you accept a PR for this smellsLikeAPromise approach on this repo?
Hello, I am getting this error since we upgraded to Angular 21:
It seems to come from this line:
We did not have it before, so I am thinking that probably something internal in Angular changed that impacts the bundling. We use the Angular
applicationbuilder (esbuild). Or maybe it's because we "externalize"single-spavia our importmap? (but we were doing that already before...)In any case, I took a look at what single-spa itself is doing internally and I believe that implementation is a bit more robust:
I have tried patching single-spa-angular with this
smellsLikeAPromiseapproach (instead ofinstanceof Promise) and that works like a charm for us.Would you accept a PR for this
smellsLikeAPromiseapproach on this repo?