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

[npm resolution]: Error importing submodule when it begins with an "@" namespace #27243

Closed
litewarp opened this issue Dec 5, 2024 · 0 comments · Fixed by #27290
Closed

[npm resolution]: Error importing submodule when it begins with an "@" namespace #27243

litewarp opened this issue Dec 5, 2024 · 0 comments · Fixed by #27290
Assignees
Labels
bug Something isn't working correctly node resolution

Comments

@litewarp
Copy link

litewarp commented Dec 5, 2024

I'm a user of the postgraphile package. Because of problems with peer dependencies across different package managers, the maintainer re-exports dependent packages in the package.json as submodules, e.g., postgraphile/cli or postgraphile/grafast.

Normally this works fine, but when attempting to import from the path postgraphile/@dataplan/pg, I seem to run into an issue with the way deno is parsing the path. In my editor, it shows that the path is not found:

Screenshot 2024-12-05 at 2 00 33 PM

When I try and run a script, it gives me the following error:

> deno run -A main.ts 
error: Invalid package specifier 'npm:postgraphile@^5.0.0-beta.35/@dataplan/pg'. 
Did you mean to write 'npm:postgraphile@^5.0.0-beta.35@dataplan/pg/'?
    at file:///Users/litewarp/projects/submodule-import/main.ts:2:32

With some research, it looks like there is a regex check somewhere in resolutions.ts set to err if the package starts with the "@" symbol.

Is there anyway to permit this given that there is no issue with other package managers? If not, is there a way to alias it to avoid this issue?

Thanks in advance!

Version:
deno 2.1.2 (stable, release, aarch64-apple-darwin)
v8 13.0.245.12-rusty
typescript 5.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants