Unable to build/serve Stencil library
See original GitHub issueRepro:
- Create a new Nx workspace
- Install
@nxext/stencil
- Run
nx g @nxext/stencil:lib my-lib
- Run
nx build my-lib
ornx serve my-lib
Expected:
Stencil library should build out to the dist
directory
Actual:
TypeError: Cannot read property 'root' of undefined
at MapSubscriber.project (<project-dir>\node_modules\@nxext\stencil\src\builders\utils\stencil-runtime.js:165:98)
at MapSubscriber._next (<project-dir>\node_modules\rxjs\internal\operators\map.js:49:35)
at MapSubscriber.Subscriber.next (<project-dir>\node_modules\rxjs\internal\Subscriber.js:66:18)
at TapSubscriber._next (<project-dir>\node_modules\rxjs\internal\operators\tap.js:65:26)
at TapSubscriber.Subscriber.next (<project-dir>\node_modules\rxjs\internal\Subscriber.js:66:18)
at TapSubscriber._next (<project-dir>\node_modules\rxjs\internal\operators\tap.js:65:26)
at TapSubscriber.Subscriber.next (<project-dir>\node_modules\rxjs\internal\Subscriber.js:66:18)
at <project-dir>\node_modules\rxjs\internal\util\subscribeToPromise.js:7:24
Job Output failed to validate. Errors:
Data path ".error" should be string.
Notes:
Typically you would need to add the --buildable
and/or --publishable
flag to the generate command for an Nx library, but this extension doesn’t support those flags.
I’m trying to migrate a UI library over from Angular to Stencil, so I followed the instructions here to add the Stencil extension and generate a Storybook config for it. Unfortunately, Storybook won’t run because it can’t resolve dist/libs/my-lib/loader
. Figured I just needed to build the library first, but no dice. Then I figured something about my current Nx workspace configuration might be borked or incompatible with this extension in some way, so I generated a new workspace with the “empty” preset, but was able to reproduce the same issue by following the steps above.
Let me know if you need any more information. I might fork this repo tonight to see if I can figure out what’s going on and submit a PR.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
I tried to reproduce, bus except the error I had cause of local changes I wasn’t able to reproduce in the playground on windows. Are you able to push a repo which doesn’t work on yours to github?
Hey @dannymcgee The --buildable behavior will change in the future, the main branch already needs a --buildable for the serve yet. I’ll take a deeper look as well and the path’s problem is a known problem for me, hard to fix as a not windows user. I started to add more e2e tests for that. The library part needs some more stuff I’m already working on, but the bug strange. I’m able to reproduce it, but the strange thing is I’m able to reproduce it with serve and build runs through 😕