angular-architects / module-federation-plugin

MIT License
719 stars 194 forks source link

Ng serve issue with Angular new build system and module federation plug in #653

Open muqtharali opened 5 days ago

muqtharali commented 5 days ago

I am using Angular v17 and web pack module federation v17 plug in for micro frontend applications.

I am trying to migrate the existing application to Angular 18 which will use the Angular new build system Application builder.

During Angular 18 migration, getting this message

image

In my existing application, it is using ngx-build-plus builder so it is not migrating to new build system.

"builder": "ngx-build-plus:browser",

So I have migrated module federation to native federation using this migration guide

https://github.com/angular-architects/module-federation-plugin/blob/main/libs/native-federation/docs/migrate.md

After this migration, it is using native-federation builder as shown below

"builder": "@angular-architects/native-federation:build",

But when I run ng serve command getting the below error

**

An unhandled exception occurred: Configuration 'development' is not set in the workspace.

**

Please let me know, if I am doing anything wrong.

Also please let me know the process to migrate existing module federation project to angular v18 new build system.

manfredsteyer commented 20 hours ago

Can you please check if your serve and build targets in angular.json have a development configuration?

muqtharali commented 4 hours ago

@manfredsteyer Please find angular.json entries for build and serve after migrating to native federation from module federation

"architect": {
                "build": {
                    "builder": "@angular-architects/native-federation:build",
                    "options": {},
                    "configurations": {
                        "production": {
                            "target": "project-name:esbuild:production"
                        },
                        "development": {
                            "target": "project-name:esbuild:development",
                            "development": true
                        }
                    },
                    "defaultConfiguration": "production"
                },
                "serve": {
                    "builder": "@angular-architects/native-federation:build",
                    "options": {
                        "target": "project-name:serve-original:development",
                        "rebuildDelay": 0,
                        "development": true,
                        "port": 0
                    }
                }

            }