-
Notifications
You must be signed in to change notification settings - Fork 135
Description
G
Hi Manfred,
I updated my Angular app from 19 to version 20.2.0.
I used these steps: https://angular.dev/update-guide?v=19.0-20.0&l=3
But after updating, I got the following error underneath, when I start the app with: 'ng serve'
I still use Webpack Module Federation!
Do you have a fix or clue why?
Kind regards,
Peter Eijgermans
⠙ Generating browser application bundles (phase: setup).../Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/webpack/lib/container/ModuleFederationPlugin.js:59
throw new TypeError(
^
TypeError: The 'compilation' argument must be an instance of Compilation
at ModuleFederationPlugin.getCompilationHooks (/Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/webpack/lib/container/ModuleFederationPlugin.js:59:10)
at /Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/webpack/lib/container/HoistContainerReferencesPlugin.js:36:33
at Hook.eval [as call] (eval at create (/Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/tapable/lib/HookCodeFactory.js:19:10), :92:1)
at Hook.CALL_DELEGATE [as _call] (/Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/tapable/lib/Hook.js:16:14)
at Compiler.newCompilation (/Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1302:30)
at /Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compiler.js:1347:29
at eval (eval at create (/Users/petereijgermans/workspaces/prorail/AZURE/plan-viewer/node_modules/tapable/lib/HookCodeFactory.js:33:10), :31:1)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
My package json:
{
"name": "plan-viewer",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "npm run create_version_file && npm run ng serve",
"starte2e": "ng run plan-viewer:serve-cypress",
"oidc": "ng serve --port 4200 --configuration oidc",
"jumphost": "ng serve --configuration jumphost",
"prebuild": "sh build/create_version_envfile.sh $npm_config_releaseversion",
"build": "ng build --configuration production",
"postbuild": "npm run extract-css && cat dist/plan-viewer/.js > dist/plan-viewer/app-pv.js",
"extract-css": "cat dist/plan-viewer/styles.css | node build/wrap-css.js > dist/plan-viewer/styles.js",
"lint": "ng lint",
"e2e": "ng e2e",
"cy:run": "cypress run",
"cy:open": "cypress open",
"cy:start": "start-server-and-test starte2e http-get://localhost:4203 cy:open",
"cy:verify": "npx cypress verify",
"e2e:cy": "npm run pretest && start-server-and-test starte2e http-get://localhost:4203 cy:run",
"clean:reports": "rm -R -f cypress/reports && mkdir cypress/reports && mkdir cypress/reports/mochareports",
"pretest": "npm run clean:reports",
"scripts": "cypress run",
"combine-reports": "mochawesome-merge cypress/reports/mocha/.json > cypress/reports/mochareports/report.json",
"generate-report": "marge cypress/reports/mochareports/report.json -f report -o cypress/reports/mochareports",
"posttest": "npm run combine-reports && npm run generate-report",
"test": "npm run scripts || npm run posttest",
"create_version_file": "sh build/create_version_envfile.sh",
"unit-test": "ng test --code-coverage",
"unit-test:ci": "ng test --browsers=ChromeHeadlessCI --no-watch --no-progress --code-coverage",
"run:all": "node node_modules/@angular-architects/module-federation/src/server/mf-dev-server.js"
},
"private": true,
"dependencies": {
"@angular-architects/module-federation": "^20.0.0",
"@angular/animations": "^20.2.0",
"@angular/cdk": "^20.2.0",
"@angular/common": "^20.2.0",
"@angular/compiler": "^20.2.0",
"@angular/core": "^20.2.0",
"@angular/forms": "^20.2.0",
"@angular/material": "^20.2.0",
"@angular/platform-browser": "^20.2.0",
"@angular/platform-browser-dynamic": "^20.2.0",
"@azure/msal-angular": "^3.0.11",
"@azure/msal-browser": "^3.7.1",
"@js-joda/core": "^5.5.3",
"@js-joda/timezone": "^2.18.0",
"@stomp/rx-stomp": "^2.0.0",
"rxjs": "~7.8.1",
"tslib": "^2.5.2",
"zone.js": "~0.15.0",
"@opentelemetry/auto-instrumentations-web": "^0.45.1",
"@opentelemetry/exporter-trace-otlp-proto": "^0.57.2",
"@opentelemetry/instrumentation": "^0.57.2",
"@opentelemetry/instrumentation-user-interaction": "^0.44.1",
"@opentelemetry/propagation-utils": "^0.30.16",
"@opentelemetry/sdk-trace-web": "^1.30.1",
"@opentelemetry/semantic-conventions": "^1.30.0",
"@opentelemetry/core": "^1.30.1",
"@opentelemetry/api": "^1.8.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^20.2.0",
"@angular/cli": "~20.2.0",
"@angular/compiler-cli": "^20.2.0",
"@angular/router": "^20.2.0",
"@cypress/schematic": "^2.5.0",
"@cypress/webpack-batteries-included-preprocessor": "^3.0.5",
"@types/jasmine": "~4.3.1",
"@types/node": "^24.3.0",
"@types/uuid": "^9.0.1",
"cypress": "^13.16.1",
"cypress-multi-reporters": "^1.6.3",
"cypress-wait-until": "^2.0.0",
"jasmine-core": "~4.6.0",
"karma": "^6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ngx-build-plus": "^20.0.0",
"npm-run-all": "^4.1.5",
"start-server-and-test": "^2.0.0",
"typescript": "~5.9.2"
}
}
and my angular.json:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"plan-viewer": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "ngx-build-plus:browser",
"options": {
"outputPath": "dist/plan-viewer",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles/styles.scss"
],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true,
"extraWebpackConfig": "webpack.config.js",
"commonChunk": false
},
"configurations": {
"jumphost": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.jumphost.ts"
}
]
},
"oidc": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.oidc.ts"
}
]
},
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"extraWebpackConfig": "webpack.prod.config.js"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": ""
},
"serve-cypress": {
"builder": "ngx-build-plus:dev-server",
"options": {
"buildTarget": "plan-viewer:build",
"port": 4203,
"publicHost": "http://localhost:4203"
},
"configurations": {
"production": {
"buildTarget": "plan-viewer:build:production"
}
}
},
"serve": {
"builder": "ngx-build-plus:dev-server",
"options": {
"buildTarget": "plan-viewer:build",
"port": 4203,
"publicHost": "http://localhost:4203",
"extraWebpackConfig": "webpack.config.js"
},
"configurations": {
"production": {
"buildTarget": "plan-viewer:build:production",
"extraWebpackConfig": "webpack.prod.config.js"
},
"development": {
"buildTarget": "plan-viewer:build:development"
},
"jumphost": {
"buildTarget": "plan-viewer:build:jumphost"
},
"oidc": {
"buildTarget": "plan-viewer:build:oidc"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "ngx-build-plus:extract-i18n",
"options": {
"buildTarget": "plan-viewer:build",
"extraWebpackConfig": "webpack.config.js"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles/styles.scss"
],
"scripts": []
}
}
}
}
},
"cli": {
"analytics": false
},
"schematics": {
"@schematics/angular:component": {
"type": "component"
},
"@schematics/angular:directive": {
"type": "directive"
},
"@schematics/angular:service": {
"type": "service"
},
"@schematics/angular:guard": {
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"typeSeparator": "."
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:pipe": {
"typeSeparator": "."
},
"@schematics/angular:resolver": {
"typeSeparator": "."
}
}
}
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@util/": [
"src/app/util/"
],
"@services/": [
"src/app/services/"
],
"@env/": [
"src/environments/"
]
},
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"experimentalDecorators": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"types": [
"jasmine",
"cypress"
],
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"useDefineForClassFields": false
}
}