-
-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular needs JIT compiler and throws error trying to share Angular between microfrontends #1164
Comments
Upon further investigation, I tried to change the packages from {
"rxjs": "https://cdn.jsdelivr.net/npm/@esm-bundle/rxjs/system/es2015/rxjs.min.js",
"rxjs/operators": "https://cdn.jsdelivr.net/npm/@esm-bundle/rxjs/system/es2015/rxjs-operators.min.js",
"@angular/core": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__core/system/es2022/ivy/angular-core.min.js",
"@angular/common": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__common/system/es2020/ivy/angular-common.min.js",
"@angular/common/http": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__common/system/es2020/ivy/angular-http.min.js",
"@angular/animations": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__animations/system/es2020/ivy/angular-animations.js",
"@angular/animations/browser": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__animations/system/es2020/ivy/angular-browser.js",
"@angular/platform-browser": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__platform-browser/system/es2020/ivy/angular-platform-browser.js",
"@angular/platform-browser/animations": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__platform-browser/system/es2020/ivy/angular-animations.js",
"@angular/platform-browser/animations": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__platform-browser/system/es2020/ivy/angular-animations.js",
"@angular/platform-browser-dynamic": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__platform-browser-dynamic/system/es2020/ivy/angular-platform-browser-dynamic.js",
"@angular/router": "https://cdn.jsdelivr.net/npm/@esm-bundle/angular__router/system/es2020/ivy/angular-router.js",
"single-spa-angular/internals": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@6.2.0/system/es2020/ivy/angular-single-spa-angular-internals.js",
"single-spa-angular": "https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@6.2.0/system/es2020/ivy/angular-single-spa-angular.js"
} But I get this error: application '@brt-it/footer-mfe' died in status LOADING_SOURCE_CODE: class heritage ɵBrowserPlatformLocation is not an object or null
execute@https://cdn.jsdelivr.net/npm/@esm-bundle/single-spa-angular@6.2.0/system/es2020/ivy/angular-single-spa-angular.js:34:13
doExec@https://cdn.jsdelivr.net/npm/systemjs@6.8.3/dist/system.js:469:34
postOrderExec@https://cdn.jsdelivr.net/npm/systemjs@6.8.3/dist/system.js:465:12
postOrderExec/<@https://cdn.jsdelivr.net/npm/systemjs@6.8.3/dist/system.js:451:43
postOrderExec@https://cdn.jsdelivr.net/npm/systemjs@6.8.3/dist/system.js:449:12
topLevelLoad/load.C<@https://cdn.jsdelivr.net/npm/systemjs@6.8.3/dist/system.js:422:14
e.prototype.invoke@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:13:7171
t.prototype.run@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:13:2271
w/<@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:27:2767
e.prototype.invokeTask@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:13:7855
t.prototype.runTask@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:13:2934
_@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:13:10171
t.invokeTask@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:13:9016
p@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:43:733
h@https://cdn.jsdelivr.net/npm/zone.js@0.11.3/dist/zone.min.js:43:967 |
Hi, please reopen the issue in https://github.com/single-spa/single-spa-angular. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug or question
Hi everyone, I am having trouble sharing Angular between multiple microfrontends, like this. I tried different things but got different errors that I could not overcome; I am not an expert on Webpack/Angular so maybe it's a simple issue, yet I can't understand where the problem lies!
Let's start with the configuration in one Angular microfrontend. This is my
webpack.config.js
:I first tried declaring externals also when running locally/in development mode, but the problem was the same.
The problem I get is in the "Console output" section below. The only way to make it work is to not add
@angular/*
libraries inexternal
. I also tried removing from externals only@angular/compiler
and@angular/platform-browser-dynamic
, but the problem stays the same.The app-root configuration with the import-map:
In the app-root configuration I tried many things, this configuration uses JSPM (I can't find the documentation that links JSPM, but I guess I found it on the single-spa docs). I had to use the
ga.system.jspm.io
for SystemJS modules instead ofga.jspm.io
because otherwise I would get these errors:To Reproduce
This is the
package.json
of the angular microfrontend:I test it via running
npm run build:single-spa:footer-mfe && sudo python3 -m http.server --directory dist/footer-mfe/
and editing thewebpack.config.js
file - the only way I could make it work is by not adding angular libraries to theexternals
array.Expected behavior
Angular is shared between frontends, reducing build size and optimizing performance when there are multiple Angular microfrontends
Screenshots and/or console output
The text was updated successfully, but these errors were encountered: