microsoft / microsoft/TypeScript

Respect Node's `--loader` for VS Code Intellisense

Open
#57,129 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

I would like VS Code to be able to use a custom Node.js loader for Intellisense.

For example, if I remove the .mjs extension from my code, I can no longer see the Intellisense for mime-types.mjs.

But my custom loader does not require the extension.

Here is what I am hoping to see: (without the .mjs extension on the import)

image

I can see the .html reference in the Intellisense drop down.

image

But here is what I actually see:

image

I think that now Node.js loaders are going through the normalization process - heading out of experimental, it is a good time for VS Code to start working on respecting loaders.

Perhaps this could live in .vscode/settings.json:

// .vscode/settings.json
{
    "loader": "./loader.mjs"
}

It would be important to provide different loaders for different directories for more complex projects/monorepos, etc:

// .vscode/settings.json
{
    "loader": {
        "./app-one": "./loaders/my-custom-loader-1.mjs",
        "./app-two": "./loaders/my-custom-loader-2.mjs",
        "./app-three": "react-loader"  // <-- Uses a package as a loader
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed .vscode/settings.json loader configuration and the Node.js --loader behavior described in the issue. Determine how Intellisense currently resolves extensionless imports, then define completion criteria for using one loader or different loaders per directory, including package-based loaders.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.