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

Unable to write a reference to #6305

Closed
bjornharvold opened this issue Jul 8, 2021 · 4 comments
Closed

Unable to write a reference to #6305

bjornharvold opened this issue Jul 8, 2021 · 4 comments
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug

Comments

@bjornharvold
Copy link

Current Behavior

Since about 10 days ago or less, all newly created libraries cannot be referenced from other libraries. It's like they are missing something. I have run diffs on all configuration files between old and newly created modules and they all look identical.

Expected Behavior

Modules should compile successfully. All older modules interoperate fine. Every new module I create now builds fine but cannot be referenced by other modules.

Steps to Reproduce

I created a repo with parts from our latest codebase. I created 2 modules in this repo with the same versions in my package.json as in my real repo. One module references the other: Github repo that reproduces error

  1. Run yarn install
  2. Run nx build geo-name-util-geo-name-pipes to make sure you successfully build the dependency
  3. Run nx build geo-name-feature-geo-name that is dependent on the previous module. This will fail.

Failure Logs

Unable to write a reference to GeoNameProvincePipe in /Users/crash/Desktop/dep/libs/geo-name/util-geo-name-pipes/src/lib/geo-name-province-pipe/geo-name-province.pipe.ts from /Users/crash/Desktop/dep/libs/geo-name/util-geo-name-pipes/src/lib/geo-name-util-geo-name-pipes.module.ts

Environment

`
Node : 12.22.2
OS : darwin x64
yarn : 1.22.10

nx : Not Found
@nrwl/angular : 12.5.7
@nrwl/cli : 12.5.7
@nrwl/cypress : 12.5.7
@nrwl/devkit : 12.5.7
@nrwl/eslint-plugin-nx : 12.5.7
@nrwl/express : Not Found
@nrwl/jest : 12.5.7
@nrwl/linter : 12.5.7
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 12.5.7
@nrwl/web : Not Found
@nrwl/workspace : 12.5.7
@nrwl/storybook : 12.5.7
@nrwl/gatsby : Not Found
typescript : 4.3.5
`

@theo-matzavinos
Copy link

Check the name property in the package.json of the library you are importing - it might not match the path in your root tsconfig.base.json. In my case the name property in the package.json was @scope/subdomain-util-lib-name while the path I was using to import was @scope/subdomain/util/lib-name.

@bjornharvold
Copy link
Author

Hi @TheophileSketo

That's exactly what it is. New libraries are created incorrectly.

Instead of @iko/shared/util-pipes it creates @iko/shared-util-pipes.

We are not creating libraries any differently than we did before. This started recently.

Don't know if related. There is a warning that's been coming up in the later versions of nx.dev:

"util-options" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.
"SchematicsLibrary" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.
"SchematicsAngularModule" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.
"SchematicsAngularComponent" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.
"SchematicsAngularService" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.

@leosvelperez leosvelperez added the scope: angular Issues related to Angular support in Nx label Jul 9, 2021
@leosvelperez
Copy link
Member

Sorry for the inconvenience!

There was an issue where the generated package name format was not in sync with what was added to the tsconfig.base.json. This was fixed in #6429 and released as part of version 12.6.0. Also, a migration to fix any wrongly generated library was merged in #6902 and released as part of version 12.9.0.

By migrating to the latest version, this issue should be solved. If you can't migrate to the latest version at this point, please make sure your library package name matches the path mapping in the tsconfig.base.json.

I'm closing this one since a fix has been merged and released. If you still have issues after updating, please feel free to reopen this issue or create a new one.

@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 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: angular Issues related to Angular support in Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants