getsentry / getsentry/sentry-javascript

Restructure core package in v11

Open
#20,995 1 comment 0 reactions 0 assignees View on GitHub
javascript
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

Today, we have three export paths in the core package:

* `@sentry/core` exports everything
* `@sentry/core/browser` exports everything that works in browser runtimes
* `@sentry/core/server` exports everything that works in server runtimes

This has two main downsides:

1. ambiguous where to import from, auto complete may pick stuff from anywhere?
2. In meta frameworks, you are forced to use `@sentry/core` anyhow as you do not know which runtime this may run in.

Because of this, I propose to restructure this a bit in v11:

* `@sentry/core` contains *only* isomorphic exports that work everywhere
* `@sentry/core/browser` contains *only* browser-specific exports (so not the things contained in `@sentry/core`)
* `@sentry/core/server` contains *only* server-specific exports.

I would also propose to move files in the core package to match this, e.g. have the following layout:

* packages/core/src
* browser/
* server/
* … other general stuff here

to make it easier to grok this.

This also makes it easier to know what can be safely used in metaframework code, as generally you should only use core APIs there when you cannot be sure in what runtime something is running etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.