angular-architects / module-federation-plugin

MIT License
730 stars 202 forks source link

Develompent build doesn't work #459

Open amaiques opened 9 months ago

amaiques commented 9 months ago

after updating my app to 17.1 and execut the ng g @angular-architects/native-federation:appbuilder when im execution: ng build --configuration development i got the following error:

[error] TypeError: Cannot read properties of undefined (reading 'split') at targetFromTargetString (C:\Users\username\Desktop\MFE\pcs-shell\pcs-shell\node_modules\@angular-devkit\architect\src\api.js:57:23) at normalizeOptions (C:\Users\username\Desktop\MFE\pcs-shell\pcs-shell\node_modules\@angular-devkit\build-angular\src\builders\dev-server\options.js:33:64)

manfredsteyer commented 9 months ago

Did you also update Angular and the CLI including @angular/dev-kit to 17.1?

amaiques commented 9 months ago

Hello @manfredsteyer , I've created a project that show the error when you exceute the script "ng build --configuration development"

mfe-development-error

give me the error from above: development-build By the way if the --configuration is production works fine.

manfredsteyer commented 9 months ago

Can you please also provide the GitHub link? I need to execute it locally.

amaiques commented 9 months ago

@manfredsteyer, I've attached the git link that you have requested: development_build_error

Muntazir86 commented 7 months ago

i am facing same error while building project in development configurations. my dev dependencies are:

"devDependencies": { "@angular-architects/native-federation": "^17.1.7", "@angular-devkit/build-angular": "^17.3.1", "@angular/cli": "~17.3.1", "@angular/compiler-cli": "^17.3.1", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.6.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "ng-packagr": "^17.3.0", "typescript": "~5.4.3" }

klopsknoedel commented 5 months ago

I had the same issue and "resolved" it by removing all occurrences of "dev": true. So

"build": {
  "builder": "@angular-architects/native-federation:build",
  "configurations": {
    "production": {
      "target": "host:esbuild:production"
    },
    "development": {
      "target": "host:esbuild:development",
      "dev": true
    }
  }
},

became

"build": {
  "builder": "@angular-architects/native-federation:build",
  "configurations": {
    "production": {
      "target": "host:esbuild:production"
    },
    "development": {
      "target": "host:esbuild:development"
    }
  }
},

I'm not quite sure what "dev": true actually does as I can turn off optimizations and enable sourcesMaps in the "development" configuration anyway.

rlarac commented 3 months ago

Same situation here... on WSL2 Ubuntu 22.04.4 LTS | Node 20.16.0 | Nx 19.5.7 | Angular 18.1.4 | @angular-architects/native-federation 18.1.2

 NX   Cannot read properties of undefined (reading 'split')

TypeError: Cannot read properties of undefined (reading 'split')
    at targetFromTargetString (/home/rlarac/dev/temp/vsa-nf-nest/node_modules/.pnpm/@angular-devkit+architect@0.1801.4_chokidar@3.6.0/node_modules/@angular-devkit/architect/src/api.js:60:29)
    at runBuilder_1 (/home/rlarac/dev/temp/vsa-nf-nest/node_modules/.pnpm/@angular-architects+native-federation@18.1.2/node_modules/@angular-architects/native-federation/src/builders/build/builder.js:69:61)
    at runBuilder_1.next (<anonymous>)
    at resume (/home/rlarac/dev/temp/vsa-nf-nest/node_modules/.pnpm/tslib@2.6.3/node_modules/tslib/tslib.js:282:48)
    at fulfill (/home/rlarac/dev/temp/vsa-nf-nest/node_modules/.pnpm/tslib@2.6.3/node_modules/tslib/tslib.js:284:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Successfully built with @klopsknoedel workaround.