.armaan.s.
.armaan.s.6mo ago

node_modules / package.json Auto Import Fix?

I'm using package.json to manage my dependencies. I'm using VSCode with the Deno extension. The auto import suggestions always tries to import from a file in node_modules, e.g.
import { Hono } from "../node_modules/hono/dist/types/index.d.ts";
import { Hono } from "../node_modules/hono/dist/types/index.d.ts";
I want it to import like
import { Hono } from "hono";
import { Hono } from "hono";
Is there a way to configure the Deno extension to import like this?
1 Reply
Deno AI Helper
Deno AI Helper6mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided, it seems like there might be a configuration issue with your VSCode setup. Deno does not use node_modules or package.json for managing dependencies. Instead, Deno imports modules directly from URLs or file paths. If your VSCode is suggesting imports from node_modules, it might be because the Deno extension is not properly configured or enabled. Here are a few things you can check: 1. Ensure that the Deno extension is installed and enabled in VSCode. 2. Make sure that Deno language server is running. You can start it by opening the command palette (Ctrl+Shift+P or Cmd+Shift+P on macOS) and typing "Deno: Start Language Server". 3. Check your workspace or global settings to ensure that Deno is set as the enabled language server for TypeScript. You can access settings by opening the command palette and typing "Preferences: Open Settings (JSON)". Please note that this advice is not based on the Deno documentation, and I advise you to double-check the accuracy of the advice given. If the issue persists, you may want to consult the VSCode documentation or seek assistance from the community for VSCode-specific configuration issues.

Did you find this page helpful?