#1966·fp-ts

ESM: Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import

Author: krutooCreated Jan 4, 2026Updated Mar 4, 2026

Bug report

Current Behavior

When type: module in package.json, trying to import Either like this is failing:

javascript
import * as E from 'fp-ts/Either'

Expected behavior

Think this is should works according to docs

Reproducible example

Suggested solution(s)

Adding exports field to package.json with all possible paths to import from package

Additional context

Your environment

Which versions of fp-ts are affected by this issue? Did this work in previous versions of fp-ts?

Software Version(s)
fp-ts
TypeScript