Skip to content

explicitly provide cjs type #247

@marklai1998

Description

@marklai1998

When importing wretch in a typescript project where target is set to cjs will yield the following error:

TS1479: The current file is a CommonJS module whose imports will produce require calls; however, the referenced file is an ECMAScript module and cannot be imported with require. Consider writing a dynamic import(wretch)' call instead.

the error is cause by hybriding cjs and esm and mark type: "module"

1 of the suggestion I can find so far is to explicitly generate a .d.cts file and update package.json to point to it

microsoft/TypeScript#53045

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions