Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/module/resolver.go
Original file line number Diff line number Diff line change
@@ -861,7 +861,7 @@ func (r *resolutionState) loadModuleFromSpecificNodeModulesDirectory(ext extensi
return fromDirectory
}
// !!! this is ported exactly, but checking for null seems wrong?
if packageInfo.Exists() &&
if rest == "" && packageInfo.Exists() &&
(packageInfo.Contents.Exports.Type == packagejson.JSONValueTypeNotPresent || packageInfo.Contents.Exports.Type == packagejson.JSONValueTypeNull) &&
r.esmMode {
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/index.ts(2,8): error TS2307: Cannot find module 'i-have-a-dir-and-main/dist/dir' or its corresponding type declarations.


==== /node_modules/i-have-a-dir-and-main/package.json (0 errors) ====
{
"name": "i-have-a-dir-and-main",
"version": "1.0.0",
"type": "module",
"main": "dist/index.js"
}

==== /node_modules/i-have-a-dir-and-main/dist/index.d.ts (0 errors) ====
export declare const a = 1;

==== /node_modules/i-have-a-dir-and-main/dist/dir/index.d.ts (0 errors) ====
export declare const b = 2;

==== /package.json (0 errors) ====
{ "type": "module" }

==== /index.ts (1 errors) ====
import 'i-have-a-dir-and-main' // ok
import 'i-have-a-dir-and-main/dist/dir' // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'i-have-a-dir-and-main/dist/dir' or its corresponding type declarations.

This file was deleted.