Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] support mts and cts declaration files #151

Closed
Hebilicious opened this issue Aug 8, 2023 · 1 comment · Fixed by #161
Closed

[feature request] support mts and cts declaration files #151

Hebilicious opened this issue Aug 8, 2023 · 1 comment · Fixed by #161

Comments

@Hebilicious
Copy link
Member

Context

This changes are integrated in the latest version of unbuild : https://github.com/unjs/unbuild/releases/tag/v2.0.0-rc.0

Supporting them at the module-builder level will make it possible to support dual cjs/mjs with valid declaration types without workarounds.

The following package.json should work without a warning :

  "exports": {
    ".": {
      "require": {
        "types": "./dist/module.d.cts",
        "default": "./dist/module.cjs"
      },
      "import": {
        "types": "./dist/module.d.mts",
        "default": "./dist/module.mjs"
      },
      "types": "./dist/module.d.ts",
      "default": "./dist/module.mjs"
    }
  },
  "main": "./dist/module.cjs",
  "module": "./dist/module.mjs",
  "types": "./dist/types.d.ts",
  "files": [
    "dist",
    "*.d.ts",
    "*.cjs",
    "*.mjs"
  ],
Copy link
Member

unbuild v2 is not yet released. when it is, this should be pretty automatic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants