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 use relative imports above jsr.json location #388

Closed
alexgleason opened this issue Apr 16, 2024 · 4 comments
Closed

Can't use relative imports above jsr.json location #388

alexgleason opened this issue Apr 16, 2024 · 4 comments

Comments

@alexgleason
Copy link

I am doing this in mod.ts:

import { NostrEvent } from '../interfaces/NostrEvent.ts';

It fails:

Screenshot from 2024-04-16 12-29-28

I am importing ../interfaces/NostrEvent.ts while having ./jsr.json. So the file I'm importing is above jsr.json

If I move jsr.json up a directory, it works. But I don't want to do that, because I'm trying to manage multiple packages in one repository, with some code copied between them. Kind of like a monorepo.

deno publish --dry-run doesn't complain. But the package is refused by JSR.

The package is: https://jsr.io/@nostrify/ndk (Which I finally got to work by temporarily moving jsr.json up one directory)

@marvinhagemeister
Copy link
Contributor

marvinhagemeister commented Apr 16, 2024

FYI: Workspace support in Deno isn't ready yet. Support for workspaces is being tracked here denoland/deno#22942

@alexgleason
Copy link
Author

Good to know. But this problem would occur even with ~/Projects/myproj/mod.ts importing ../otherproj/b.ts

Importing local code from outside of the JSR working directory should work, right?

@marvinhagemeister
Copy link
Contributor

Right now the assumption is that the packages jsr.json/deno.json is at the root of the package. Once support for workspaces land it will be possible to reference packages in other folders, but not importing files from above the package folder. It's very unlikely that we'll ever add support for that as it introduces significant complexity and edge cases during the publish process.

We haven't decided on that in the team yet, but my feeling is that we'd rather spent time working on other JSR stuff in the coming months. I wouldn't plan my code around this being supported anytime soon (if at all).

@alexgleason
Copy link
Author

Thank you for clarifying @marvinhagemeister

In that case I'll close this in favor of denoland/deno#22942

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

No branches or pull requests

2 participants