Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issue with library and project #333

Closed
ruslanguns opened this issue Jul 15, 2019 · 8 comments
Closed

Build issue with library and project #333

ruslanguns opened this issue Jul 15, 2019 · 8 comments

Comments

@ruslanguns
Copy link

I'm submitting a...


[ ] Regression 
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Default nestjs project when you build it creates a simple structure dist in your root folder:

├───dist
│   ├───modules
│   └───shared

But if you add a library from schematics and in build it have different behaviour

├───dist
│   ├───libs
│   └───src
│       ├───auth
│       └───shared

So nodemon does not work properly since it by default look at dist not at dist/src.

Minimal reproduction of the problem with instructions

  • Create a hello world project in nestjs
  • Add from schematics a new library with any prefix
  • Try start:dev or prod (it wont start properly, only will built the dist folder.)

Environment

OS: Windows
Nestjs Version 6.5.0
Node Version: v12.3.1
NPM Version: 6.10.0
@kamilmysliwiec
Copy link
Member

Yes, you have to update your configuration manually. Library feature is still not fully covered

@ruslanguns

This comment has been minimized.

@ruslanguns
Copy link
Author

ruslanguns commented Jul 15, 2019

I updated the node_modules and it is working as expected
image

@ruslanguns
Copy link
Author

I am reopening the issue. Since it's happening again. I am providing a sample repo for easy to go reproduction: https://github.com/ruslanguns/nestjs-test-repo

Comands yarn start:prod, yarn build, yarn start:dev are not working, since the tsconfig is wrong with the schematics (my guess).

@ruslanguns ruslanguns reopened this Jul 16, 2019
@ruslanguns
Copy link
Author

@jmcdo29 provided a work around in a PR ruslanguns/nestjs-test-repo#1 (comment) hope it can help others to find a temporary solution.

@jedjebari
Copy link

I have the same kind of issue when putting a typescript file in my root dir (ie at the same level than src folder)
To fix that, I would say that you need to play with rootDir and include options in your tsconfig files.

But at the end, I guess you might want to build your artifacts in separate folders : dist/libs/utils and dist/website. I mean that you will want to replace src by something else. So you might put your folders libs/utils and website under a src folder

@kamilmysliwiec : I understand that library is not fully supported, but if you agree I would be happy to submit a PR to update the current tsconfig file with a rootDir (because it's so easy to add a ts file in rootDir, that's what I always do when I read the graphql doc with generate-typings.ts : https://docs.nestjs.com/graphql/quick-start)

@kamilmysliwiec
Copy link
Member

@jedjebari PRs are always welcome!

@kamilmysliwiec
Copy link
Member

This issue is addressed by the lastest changes to the CLI https://trilon.io/blog/announcing-nestjs-monorepos-and-new-commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants