fullstack-build/tslog

Question - CommonJS with TypeScript 5.x and tslog

Opened this issue · 3 comments

Recently, CJS has been added to this lib, which I am quite happy with. However, in my current project I'd like to use it with TypeScript where I ran into an issue.

When my IDE (VSCode) checks for module compatibility, it looks into the package.json of the library. Since the /types/ directory is located in the folder that has "type": "module" in the package.json, it will give me a warning that it'll be using ESM. Except this is not the case, when I ts-ignore this error the code transpiles fine:

Without ts-ignore
image

With ts-ignore
image

I can unfortunately not switch to ESM because of my difficult setup with other dependencies, and I am also not a fan of using ts-ignore to solve problems.

Is it an idea to make an import like import { Logger, ILogObj } from "tslog/cjs"; which has typings and "type": "commonjs" in the package.json? Or am I missing something here?

Is there an update on this matter?

Is there an update on this matter?

I just made a simple logger till this is fixed/ someone knows a workaround, but I haven't spent much energy on trying anything since the project above is currently shelved 👍

same issue. any update now ?