Closed JonSilver closed 1 year ago
I surmise it's going wrong at lines 38 & 40 of packages/func/src/executors/common/get-copy-package-to-app-transformer-factory.ts
where you're indexing into .dependencies
. If it's not there, it's undefined. So inserting a simple check and setting dependencies
to {}
would fix it. I could submit a PR if you like @AlexPshul.
That's quite a thorough investigation you did there. A PR to fix this would be very much welcome! :)
PR to fix this would be very much welcome! :)
I'll give it a go over the next couple of days 👍
Thank you again for taking care of this :)
So... I've been struggling to get an existing project into an nx monorepo and now I know why.
It's fairly natural to copy over all the existing code into a newly generated project, and cut and paste all of the function app's dependencies to the root
package.json
.But if you don't leave an empty
dependencies
field in the function app project'spackage.json
, the generator will fail to copy over the relevant dependencies during build. What's worse is there's no relevant error message either.Steps to reproduce:
In an nx function app project created with
@nxazure/func
, delete thedependencies
section completely. Try a build. It'll fail with the error messageCannot read properties of undefined (reading 'tsconfig-paths')
, which isn't exactly helpful.If you just include
"dependencies": {},
then it'll work just fine, building and running smoothly.I hope this bug report helps, @AlexPshul. Thanks again for all your hard work on this generator.