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

Can't self-reference a scoped package using its name #11161

Closed
piranna opened this issue Mar 6, 2021 · 4 comments
Closed

Can't self-reference a scoped package using its name #11161

piranna opened this issue Mar 6, 2021 · 4 comments

Comments

@piranna
Copy link
Contributor

piranna commented Mar 6, 2021

Not sure if it's a Node.js or jest-resolve issue, so I'm cross-posting it.

🐛 Bug Report

At Node.js packages docs it says it's possible to self-reference and import a package from it's own modules by using the package name, the same was as it's done with dependencies installed on node_modules. I'm self-referencing my package itself in my jest tests, it says it can't find it:

   Test suite failed to run

    Cannot find module '@piranna/rpc' from '__tests__/index.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)

Since my package has a scope (package name is in the form with @<scope>/<packageName>) and there's no examples or references in Node.js docs about self-referencing scoped packages, maybe this is a Node.js packages resolving algorythm.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

The self-referenced package should be imported.

Link to repl or repo (highly encouraged)

envinfo

  System:
    OS: Linux 5.8 Ubuntu 20.10 (Groovy Gorilla)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 15.10.0 - /usr/bin/node
    npm: 7.5.3 - /usr/bin/npm
@piranna
Copy link
Contributor Author

piranna commented Mar 6, 2021

Node.js issue at nodejs/node#37618

@SimenB
Copy link
Member

SimenB commented Mar 6, 2021

Duplicate of #10883

@SimenB SimenB marked this as a duplicate of #10883 Mar 6, 2021
@SimenB SimenB closed this as completed Mar 6, 2021
@piranna
Copy link
Contributor Author

piranna commented Mar 6, 2021

Duplicate of #10883

Thank you for the reference :-)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants