fix(cli): resolve bare '.' and '..' import specifiers to directory index files [RED-918] [ship] - #1458
Merged
Merged
Conversation
…dex files [RED-918] isLocalPath only recognized the '/', './' and '../' prefixes, so bare '.' and '..' import specifiers fell through and were classified as npm package names. The imported directory's index file was silently omitted from the code bundle, and checks failed at runtime with "Directory import '...' is not supported resolving ES modules". Treat exact '.' and '..' as local paths; the existing extension-less lookup chain then resolves them to the directory's index file. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sorccu
enabled auto-merge (squash)
August 28, 2026 10:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Bare
.and..import specifiers (e.g.import { foo } from '..') were misclassified as npm package names byisLocalPathin the check parser, which only tested the/,./and../prefixes. The imported directory's index file was silently omitted from the code bundle — the importing file itself shipped fine — so the gap only surfaced at runtime asDirectory import '…' is not supported resolving ES modules(in a real customer suite this cascaded to 0 discoverable tests). In restricted mode the same misclassification instead reported the specifier as an unsupported npm module.How
isLocalPathnow treats exact.and..as local paths. The existing extension-less lookup chain then resolves them to the directory's index file via the normal candidate order; no resolver changes were needed. A code comment notes that the predicate also gates tsconfigextendsand package.jsonimportstarget resolution, where a bare./..is a degenerate config either way.Tests
New
bare-dot-importsfixture coveringfrom '.',from '..'andfrom '../'directory-index imports, exercised in both restricted and unrestricted parser modes. Both tests were verified to fail without the fix.Closes RED-918.
🤖 Generated with Claude Code