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

Import maps not recognized for nested deno projects #1117

Closed
nandorojo opened this issue May 17, 2024 · 1 comment
Closed

Import maps not recognized for nested deno projects #1117

nandorojo opened this issue May 17, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@nandorojo
Copy link

nandorojo commented May 17, 2024

Describe the bug

If you have a Deno project in a sub-folder of your repository, then its deno.json won't get recognized. It looks like the VSCode Extension only checks the root of your project for a deno.json file. However, it should also be checking deno.enablePaths locations.

As a result, monorepos using deno cannot use imports properly.

Screenshot 2024-05-17 at 11 41 36 AM

To Reproduce

  1. Create a subfolder, like ./projects/deno
  2. In .vscode/settings.json, enable Deno and add deno.enablePaths: './projects/deno'
  3. Add a deno.json file at ./projects/deno/deno.json
  4. In deno.json, add imports like so:
{
  "imports": {
    "~public/": "./public/"
  }
}
  1. Create a file at ./projects/deno/public/test.ts: export default 1
  2. Create a file at ./projects/deno/root.ts: import test from '~public/test.ts
  3. Watch as it errors.

Workaround: Open ./projects/deno in VSCode directly (not desired).

Expected behavior

Import paths should work relative to the location of the deno.json file. And in fact, they do. However, the VSCode extension doesn't seem to pick them up.

The workaround is to open the nested folder in VSCode directly. However, this is a workaround at best.

Screenshots

See above.

Versions

vscode: 1.89.1
deno: 1.43.3
extension: v3.37.1

Thank you for your help.

@nayeemrmn
Copy link
Collaborator

Tracked in #787.

@nayeemrmn nayeemrmn added the duplicate This issue or pull request already exists label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants