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

[Bug]: Correctly export CommonJS types #5604

Open
1 task done
JavaScriptBach opened this issue Sep 9, 2024 · 0 comments
Open
1 task done

[Bug]: Correctly export CommonJS types #5604

JavaScriptBach opened this issue Sep 9, 2024 · 0 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@JavaScriptBach
Copy link

Affected Packages

All packages

Version(s)

2.6.6

Bug Description

Each package exports CJS + ESM implementations, but only one version of types. This makes Typescript think that the package is always ESM, which means that Typescript will not allow importing this package from CommonJS while using Node16 module resolution.

The fix is to change the build to output CJS types as well ESM types, and then update the package.jsons to something like this:

  "exports": {
      ".": {
        "types": {
            "import": "./dist/packages/extension-bullet-list/src/index.d.ts",
            "require": "./dist/packages/extension-bullet-list/src/index.d.cts"
         }
        "import": "./dist/index.js",
        "require": "./dist/index.cjs"
    }
  },

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

See above

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@JavaScriptBach JavaScriptBach added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Triage open
Development

No branches or pull requests

1 participant