Skip to content
Discussion options

You must be logged in to vote

Nope, you just set the .d.ts files in the exports like from the example in the README.

In this example, it uses .d.cts and .d.mts to explicitly indicate whether its a CommonJS module or ES module:

    "exports": {
        "require": {
            "types": "./dist/index.d.cts",
            "default": "./dist/index.cjs",
        },
        "import": {
            "types": "./dist/index.d.mts",
            "default": "./dist/index.mjs",
        },
    },

Learn more on this here:
https://hirok.io/posts/package-json-exports#targeting-node-js-esm-cjs-type-definitions


esbuild just doesn't support preserving comments in the parsing stage and only made exceptions for special kind of comments like…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@MatthewSH
Comment options

@privatenumber
Comment options

@MatthewSH
Comment options

@privatenumber
Comment options

Answer selected by MatthewSH
@MatthewSH
Comment options

@MatthewSH
Comment options

@privatenumber
Comment options

@privatenumber
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants