Skip to content

Directory import is not supported resolving ES modules #1910

@thobson

Description

@thobson

🐛 Bug report

Firstly, apologies but I'm not sure if this is an fp-ts issue or a vite/webpack/sveltekit issue but I'd be grateful for any pointers ...

Current Behavior

I'm importing using this syntax:

import { pipe } from "fp-ts/function";

When running vite dev everything works fine, however after building and running the svelte kit app I get this error:

Directory import 'node_modules/fp-ts/function' is not supported resolving ES modules imported from .svelte-kit/output/server/entries/pages/_page.svelte.js

Additional context

I can work around the issue by importing like this:

import { pipe } from "fp-ts/es6/function";

However this then raises an error during vite dev

.pnpm/[email protected]/node_modules/fp-ts/es6/function.js:17
export var getBooleanAlgebra = function (B) {
^^^^^^

SyntaxError: Unexpected token 'export'

Your environment

Software Version(s)
fp-ts 2.16.1
TypeScript 5.2.2
vite 4.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions