Skip to content

Problem importing lightship #63

@rjbma

Description

@rjbma

In my typescript ESM project, i get the following error when trying to use import { createLightship } from 'lightship';:

Cannot find module 'lightship' or its corresponding type declarations.ts(2307)

One way to fix this would be to edit my tsconfig.json file:

"moduleResolution": "nodenext",   // or "node16"       

The problem with this is that now a lot of other dependencies in my project will start to break, particularly the ones that use default exports (see microsoft/TypeScript#50175).

One way to solve the problem would be to add "main": "./dist/index.js" to Lightship's package.json. This way, the exports section would still take precedence, but main would make sure that environments with "moduleResolution": "node" would still work.

Would it be possible to add the main prop to pacakge.json?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions