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?
In my typescript ESM project, i get the following error when trying to use
import { createLightship } from 'lightship';:One way to fix this would be to edit my tsconfig.json file:
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, theexportssection would still take precedence, butmainwould make sure that environments with"moduleResolution": "node"would still work.Would it be possible to add the
mainprop to pacakge.json?