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

@sentry/browser's require types are missing #12295

Closed
3 tasks done
davidmurdoch opened this issue May 30, 2024 · 2 comments · Fixed by #12305
Closed
3 tasks done

@sentry/browser's require types are missing #12295

davidmurdoch opened this issue May 30, 2024 · 2 comments · Fixed by #12305
Assignees
Labels
Package: browser Issues related to the Sentry Browser SDK Type: Bug

Comments

@davidmurdoch
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

8.7.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

Init a new node project (I used node 20 with yarn 1)

run:

yarn init -y

run:

yarn add typescript@5.4.5 @sentry/browser@8.7.0

create tsconfig.json:

{
    "compilerOptions": {
        "strict": true, // changes type warning to error
        "moduleResolution": "node16" // causes typescript to use `require` resolution instead of `import`
    }
}

create index.ts:

import * as Sentry from "@sentry/browser";

You'll find that the project can't compile because import * as Sentry from "@sentry/browser"; errors because Could not find a declaration file for module '@sentry/browser'.

This is because the package.json for '@sentry/browser' (the published version, not the version in this repo) has this exports section:


"exports": {
    "./package.json": "./package.json",
    ".": {
      "import": {
        "types": "./types/index.d.ts",
        "default": "./esm/index.js"
      },
      "require": {
        "types": "./build/npm.types/index.d.ts",
        "default": "./cjs/index.js"
      }
    }
  },
  

which specifies that require types live at ./build/npm.types/index.d.ts, but this file doesn't exist.

Maybe related, but the published package.json doesn't match what's in this repo at time of release. Yikes.

Expected Result

types should work

Actual Result

types don't work

@github-actions github-actions bot added the Package: browser Issues related to the Sentry Browser SDK label May 30, 2024
@mydea
Copy link
Member

mydea commented May 31, 2024

Huh, good catch - sorry about that, it seems that a typo sneaked in there. We'll fix this!

@AbhiPrasad
Copy link
Member

Fix released with https://github.com/getsentry/sentry-javascript/releases/tag/8.8.0 - sorry for the trouble!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: browser Issues related to the Sentry Browser SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants