angular-architects / module-federation-plugin

MIT License
724 stars 194 forks source link

Unable to use esbuild plugins in native-federation #665

Open thefirst24 opened 4 days ago

thefirst24 commented 4 days ago

With what library do you have an issue?

native-federation

Reproduction of the bug/regression with instructions

  1. Set "@angular-architects/native-federation:build" executor for serve target with target option "project:serve-original:development"
  2. Set "@angular-devkit/build-angular:dev-server" executor for "serve-original" target with build target "project:esbuild:development"
  3. Set "@angular-builders/custom-esbuild:application" or "@nx/angular:application" executor for "esbuild" target
  4. Add plugins to options for esbuild target
  5. Run "nx serve project" command
  6. Get error "Data path "" must NOT have additional properties(plugins)."

Full error: Error: Schema validation failed with the following errors: Data path "" must NOT have additional properties(plugins). at name (node_modules\@angular-devkit\architect\src\architect.js:228:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I logged builderName variable in _validateOptionsFactory in architect.js line and it print out "@angular-devkit/build-angular:application" for some reason

Expected behavior

Successfully build the application with esbuild plugins.

Versions of Native/Module Federation, Angular, Node, Browser, and operating system

"dependencies": { "@angular/animations": "18.2.0", "@angular/common": "18.2.0", "@angular/compiler": "18.2.0", "@angular/core": "18.2.0", "@angular/forms": "18.2.0", "@angular/platform-browser": "18.2.0", "@angular/platform-browser-dynamic": "18.2.0", "@angular/router": "18.2.0", }, "devDependencies": { "@angular-architects/module-federation": "^18.0.6", "@angular-architects/native-federation": "^18.2.2", "@angular-builders/custom-esbuild": "^18.0.0", "@angular-devkit/build-angular": "^18.2.0", "@angular-devkit/core": "18.2.0", "@angular-devkit/schematics": "18.2.0", "@angular/build": "^18.2.8", "@angular/cdk": "18.2.0", "@angular/cli": "~18.2.0", "@angular/compiler-cli": "18.2.0", "@nx/angular": "19.6.1", "@nx/devkit": "19.6.1", "@nx/jest": "19.6.1", "@nx/js": "19.6.1", "@nx/playwright": "19.6.1", "@nx/plugin": "19.6.1", "@nx/web": "19.6.1", "@nx/webpack": "19.6.1", "@nx/workspace": "19.6.1", "nx": "19.6.1", "typescript": "5.5.4", }

Other information

No response

I would be willing to submit a PR to fix this issue

rainerhahnekamp commented 2 days ago

@thefirst24 please provide a reproducible stackblitz example as provided in the template you used to create this issue.