nxext/nx-extensions

Stencil - adding Angular outputtarget throws Cannot read properties of undefined (reading 'kind')

sfosterdiscovery opened this issue · 3 comments

Describe the bug
A clear and concise description of what the bug is.
When attempting to add the angular outputtarget under v17, the following error is thrown: Cannot read properties of undefined (reading 'kind')

To Reproduce
Steps to reproduce the behavior:
setup NX ( an Angular 17 monorepo) to the following versions:

   Node   : 18.15.0
   OS     : darwin-x64
   npm    : 9.5.0
   
   nx (global)        : 17.1.3
   nx                 : 17.1.3
   @nx/js             : 17.1.3
   @nx/jest           : 17.1.3
   @nx/linter         : 17.1.3
   @nx/eslint         : 17.1.3
   @nx/workspace      : 17.1.3
   @nx/angular        : 17.1.3
   @nx/cypress        : 17.1.3
   @nx/devkit         : 17.1.3
   @nx/eslint-plugin  : 17.1.3
   @nx/react          : 17.1.3
   @nx/storybook      : 17.1.3
   @nrwl/tao          : 17.1.3
   @nx/web            : 17.1.3
   @nx/webpack        : 17.1.3
   typescript         : 5.3.2
   ---------------------------------------
   Community plugins:
   @nxext/stencil     : 17.0.2
   @storybook/angular : 7.6.0

Add stencil plugin then attempt to add the target with:
nx g @nxext/stencil:add-outputtarget design-system --verbose

Expected behavior
A clear and concise description of what you expected to happen.
Output target should be created successfully.

Additional context
Add any other context about the problem here.

Full stack trace of error:

TypeError: Cannot read properties of undefined (reading 'kind')
    at _angularImportsFromNode (/Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/utils/angular-ast-utils.js:13:16)
    at /Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/utils/angular-ast-utils.js:56:24
    at Array.map (<anonymous>)
    at getDecoratorMetadata (/Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/utils/angular-ast-utils.js:56:10)
    at _addSymbolToNgModuleMetadata (/Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/utils/angular-ast-utils.js:94:19)
    at addDeclarationToModule (/Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/utils/angular-ast-utils.js:215:12)
    at addLibraryDirectives (/Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/generators/add-outputtarget/add-angular/generator.js:61:65)
    at /Users/sfoster/Documents/GitHub/foundry/node_modules/@nxext/stencil/src/generators/add-outputtarget/add-angular/generator.js:73:9
    at Generator.next (<anonymous>)
    at fulfilled (/Users/sfoster/Documents/GitHub/foundry/node_modules/tslib/tslib.js:166:62)

I have the same issue

I can confirm the issue. I've got the same in a brand new Nx workspace with the latest Nx v17.2.8.

CleanShot 2024-01-03 at 16 53 49@2x

I have same issue. Any update regarding this?