Skip to content

(Regression) Node module resolution does not respect package.json in sub-folders #18988

Closed
@Seikho

Description

@Seikho

TypeScript Version: 2.5.3 / next

Code

See a minimal repro at https://github.com/seikho/resolution-repro

Importing from module/sub-folder returns a compiler error when no index.ts is present despite a package.json with a valid typings property being present.

// Should work when node_modules/mod/mod-a contains a package.json with "typings" property
import { add } from 'mod/mod-a'

// A workaround will work however
import { add } from 'mod/mod-a/src'

Expected behavior:
Should compile okay

Actual behavior:
Fails to compile with error TS2307: Cannot find module 'mod/mod-a'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions