Skip to content

fix(dts): try the .json file itself after .d.json.ts for json imports - #1377

Merged
Boshen merged 4 commits into
oxc-project:mainfrom
ocavue:fix/dts-json-extension
Sep 23, 2026
Merged

Boshen merged 4 commits into
oxc-project:mainfrom
ocavue:fix/dts-json-extension

Conversation

@ocavue

@ocavue ocavue commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

resolve_dts only tried .d.json.ts for import "./data.json" and never the .json file itself, so JSON imports failed under the dts resolver even though TypeScript's bundler mode resolves them (resolveJsonModule defaults to true there).

This mirrors tryAddingExtensions in TypeScript (linked in the code comments): https://github.com/microsoft/TypeScript/blob/v6.0.3/src/compiler/moduleNameResolver.ts#L2155-L2158

Re-implements #1052, which was merged into a stacked branch and never reached main.

@ocavue
ocavue marked this pull request as ready for review September 7, 2026 08:40
@Boshen
Boshen enabled auto-merge (squash) September 23, 2026 07:18
@Boshen
Boshen merged commit 1971b77 into oxc-project:main Sep 23, 2026
14 checks passed
@codspeed

codspeed Bot commented Sep 23, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 6.78%

❌ 5 regressed benchmarks
✅ 16 untouched benchmarks
⏩ 5 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ pm/npm-flat 1.8 ms 2 ms -10.05%
❌ resolver_real[multi-thread] 496.2 µs 543.5 µs -8.7%
❌ pm/bun-flat 1.8 ms 1.9 ms -5.23%
❌ pm/bun-isolated 2 ms 2.1 ms -5.09%
❌ pm/yarn-flat 1.8 ms 1.9 ms -4.72%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ocavue:fix/dts-json-extension (7c07330) with main (0ac26d9)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@oxc-guard oxc-guard Bot mentioned this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants