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

Bug with nx lib creation in converted project #241

Closed
xeax opened this issue Jan 29, 2018 · 9 comments
Closed

Bug with nx lib creation in converted project #241

xeax opened this issue Jan 29, 2018 · 9 comments
Assignees
Labels
blocked: retry with latest Retry with latest release or head. outdated type: bug

Comments

@xeax
Copy link

xeax commented Jan 29, 2018

OS: Win

Angular 4 project was converted to Nx Workspace with:

npm install --save-dev @nrwl/schematics
ng generate workspace backoffice --collection=@nrwl/schematics

lib added with command:
ng generate lib fake-db --nomodule

resulting libs/fake-db/index.ts containing:
export {FakeDb} from './apps\backoffice\src/fake-db';
Single \ is error here.

May be good solution is to use only "/" in all paths.

PS: And I don't understand such folder structure for new library.
Why ./apps/backoffice/src instead of ./src?

@xeax
Copy link
Author

xeax commented Jan 29, 2018

Serving app (with new library used) with command:
ng serve --app=backoffice
fails with this error:
ERROR in F:/mc/apps/backoffice/src/app/app.component.ts (3,24): Cannot find module '@backoffice/fake-db'.
even if I change libs/fake-db/index.ts to:
export {FakeDb} from './apps/backoffice/src/fake-db';

May be problem in apps/backoffice/src/tsconfig.app.json containing option:
{ ... , "compilerOptions": { ... , "baseUrl": "", ... }, ... }

Removing this option allow normal app serving and prod-building. May be it is a second bug?

PS: I didn't found such option in nx-example apps configs and any apps created in Nx Workspaces created with create-nx-workspace command.

@phl3x0r
Copy link

phl3x0r commented Feb 5, 2018

See #250

@vsavkin
Copy link
Member

vsavkin commented Feb 19, 2018

It should be fixed once we switch to the Angular CLI 1.7.

@vsavkin vsavkin self-assigned this Feb 19, 2018
@vsavkin vsavkin added the blocked: retry with latest Retry with latest release or head. label Mar 9, 2018
@vsavkin
Copy link
Member

vsavkin commented Mar 9, 2018

@xeax could you try it with Nx 0.8?

@xeax
Copy link
Author

xeax commented Mar 10, 2018

On

@angular/cli 1.4.10
@nrwl/schematics 0.8.0

My results:

F:\test>npm install --save-dev @nrwl/schematics
+ @nrwl/[email protected]
added 117 packages in 32.831s

F:\test>ng generate workspace backoffice --collection=@nrwl/schematics
  create test.js (1033 bytes)
  update package.json (3139 bytes)
  update .angular-cli.json (1697 bytes)
  update protractor.conf.js (889 bytes)

F:\test>ng generate lib fake-db --nomodule
Error: context.addTask is not a function
context.addTask is not a function

May be I need upgrade angular/cli?

@vsavkin
Copy link
Member

vsavkin commented Mar 10, 2018

Yup. You need to upgrade the CLI to 1.7+

@xeax
Copy link
Author

xeax commented Mar 10, 2018

On

@angular/cli 1.7.3
@nrwl/schematics 0.8.0

lib added with command:
ng generate lib fake-db --nomodule

resulting libs/fake-db/index.ts containing:
export { FakeDb } from './src/fake-db';

Now it is correct path without any errors. Thank you!

Tomorrow I'll try to check "Cannot find module" error.

@vsavkin
Copy link
Member

vsavkin commented Apr 25, 2018

Closing this as the issue has been resolved by the CLI team.

@vsavkin vsavkin closed this as completed Apr 25, 2018
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: retry with latest Retry with latest release or head. outdated type: bug
Projects
None yet
Development

No branches or pull requests

3 participants