Skip to content

.mts / .mjs files are not indexed (ESM TypeScript/JS module extensions skipped by file discovery) #366

@Romainnoo145

Description

@Romainnoo145

Summary

.mts and .mjs files are not indexed at all. These are the standard TypeScript / JavaScript ES module file extensions (.mts = TS ESM, .mjs = JS ESM, TS handbook). tree-sitter-typescript/javascript parse them identically to .ts/.js, so this looks like a file-discovery glob omission rather than a parser limitation.

For Node.js codebases that use the explicit ESM extensions (very common in modern Node 20/22 backends, CLIs, and tooling), this means the entire backend is invisible to the graph while the .ts/.tsx frontend indexes perfectly.

Reproduction

On a monorepo whose backend/CLI/packages are authored in .mts:

codegraph init -i .
codegraph status        # languages show only tsx / typescript — no .mts
codegraph files | grep -c '\.mts'   # -> 0
codegraph query "<a symbol that lives in a .mts file>"   # -> No results found

Evidence (real repo)

A repo with 133 git-tracked .mts files:

  • codegraph statusFiles: 196, languages: tsx 103, typescript 64zero .mts
  • codegraph files | grep -c '\.mts'0
  • codegraph query for symbols known to live in .mts files → No results found
  • codegraph query "Client" (a .tsx symbol) → works perfectly, returns Clients.tsx:26, ClientDTO, ClientCard with file:line

So discovery + parsing + search all work for .ts/.tsx; .mts/.mjs are simply never picked up.

Expected

.mts and .mjs are discovered and parsed the same as .ts / .js (and .cts/.cjs for completeness — the CommonJS explicit extensions).

Notes

  • There is no index flag (--include / extension list) and no documented config (see Document config or create a json schema for it #283) to add extensions as a workaround, so end users can't opt in manually.
  • Likely a one-line addition to the file-discovery extension set + language mapping.

Environment

  • CodeGraph v0.9.3 (standalone installer, bundled runtime)
  • Linux x64, Node 22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions