nxext / nx-extensions

Nx Extensions for Stencil, Svelte, SolidJS, Preact, Ionic, and Capacitor
MIT License
458 stars 101 forks source link

Stencil: `Cannot convert undefined or null to object` #1087

Open thure opened 5 months ago

thure commented 5 months ago

Describe the bug When trying to run nx g @nxext/stencil:lib my-lib in a fresh Nx workspace, the target errors:

❯ ./node_modules/.bin/nx g @nxext/stencil:lib my-lib --verbose

 NX  Generating @nxext/stencil:library

✔ Which stylesheet format would you like to use? · css

 NX   Cannot convert undefined or null to object

TypeError: Cannot convert undefined or null to object
    at ~/Projects/nxext-stencil-project/node_modules/@nxext/stencil/src/generators/library/lib/update-tsconfig.js:8:35
    at updateJson (~/Projects/nxext-stencil-project/node_modules/nx/src/generators/utils/json.js:45:26)
    at updateTsConfig (~/Projects/nxext-stencil-project/node_modules/@nxext/stencil/src/generators/library/lib/update-tsconfig.js:6:29)
    at ~/Projects/nxext-stencil-project/node_modules/@nxext/stencil/src/generators/library/generator.js:54:46
    at Generator.next (<anonymous>)
    at fulfilled (~/Projects/nxext-stencil-project/node_modules/tslib/tslib.js:166:62)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

To Reproduce Follow the directions provided in the package:

Add this plugin to an Nx workspace

Then continue to follow the directions provided in the package:

Generate your projects

This second step will fail as above.

Expected behavior The tool generates the project without errors.

Additional context It’s clear that “add this plugin to an Nx workspace” is not specific enough – is there an example Nx workspace available in which this command is demonstrated to work? Has this only been tested in certain engine versions?