Skip to content

Commit e73ab21

Browse files
committed
feat: Inline @sentry/core dependency
1 parent 553176a commit e73ab21

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

packages/bundler-plugin-core/build.config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,25 @@ export default defineBuildConfig({
1919
},
2020
},
2121
hooks: {
22-
"rollup:options": (_ctx, opts) => {
22+
"rollup:options": (ctx, opts) => {
23+
// We want to ensure that `@sentry/core` is not externalized
24+
// So we do not ship this dependency to users, as this may lead to conflicts with their installed Sentry versions
25+
// TODO: When unbuild is updated to 3.3.0, this can be simplified by configuring `inlineDependencies`
26+
// See: https://github.com/unjs/unbuild/releases/tag/v3.3.0
27+
// Inspired by https://github.com/nuxt/nuxt/blob/f0ce20388d2ab533eba016de0565c150ea3c5172/packages/schema/build.config.ts#L23-L34
28+
ctx.options.rollup.dts.respectExternal = false;
29+
const isExternal = opts.external as (
30+
id: string,
31+
importer?: string,
32+
isResolved?: boolean,
33+
) => boolean;
34+
opts.external = (source, importer, isResolved) => {
35+
if (source === "@sentry/core") {
36+
return false;
37+
}
38+
return isExternal(source, importer, isResolved);
39+
};
40+
2341
if (process.env.PLUGIN_CODECOV_TOKEN && Array.isArray(opts.plugins)) {
2442
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-floating-promises
2543
opts.plugins = [

packages/bundler-plugin-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
"dependencies": {
4242
"@actions/core": "^1.10.1",
4343
"@actions/github": "^6.0.0",
44-
"@sentry/core": "^8.42.0",
4544
"chalk": "4.1.2",
4645
"semver": "^7.5.4",
4746
"unplugin": "^1.10.1",
4847
"zod": "^3.22.4"
4948
},
5049
"devDependencies": {
5150
"@octokit/webhooks-definitions": "^3.67.3",
51+
"@sentry/core": "^8.42.0",
5252
"@types/node": "^20.11.15",
5353
"@types/semver": "^7.5.6",
5454
"@vitest/coverage-v8": "^2.1.8",

0 commit comments

Comments
 (0)