Skip to content

nestjs example with node-package requires includes/paths that point to local node_modules #87

@airtonix

Description

@airtonix
  1. If you add @company/browser-package to the nestjs app and run moon run nestjs-app:dev then:
  • the tsconfig updates with a new reference that point to ../../packages/browser-package
  1. If you hard revert all changes and try again with @company/node-package, nothing happens.
  2. If you manually do the changes to mimic what was done in #1 and then try to create some.service.ts that makes use of the add function from @company/node-package then you get an error that this file(or any file in the nest-js package) is not included. This is because the includes directive is not in the nestjs-app tsconfig.json but instead in the tsconfig.build.json where the editor can't see it.
  3. if you make that correction for #3 then you get the next error which is that the node-package files are not in the rootDir examples/apps/nestjs-app. adding rootDir: "./" to the root tsconfig.options.json fixes this.
  • if you're following along incrementally here, then moon run nestjs-app:dev will work
  • remove the build directory now
  1. now that we have rootDir in the root tsconfig.options.json and our node-package properly referenced in the nestjs-app tsconfigs... running moon run nestjs-app:dev fails because the build directory no longer reflects the structure of the nestjs-app src directory, instead it reflect the structure of the monorepo so nest-cli can't find build/src/main (which is now at build/apps/nestjs-app/src/main)
  2. if you roll all the changes back to #2 and instead of using ../../packages/node-package, use node_modules/company/node-package and now everything works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions