Repository navigation
Conversation
6c6289e to
91c031e
Compare
size-limit report 📦
|
91c031e to
cc3d3bc
Compare
cc3d3bc to
336cf7d
Compare
755fc00 to
00d9d69
Compare
00d9d69 to
c448399
Compare
f1386d1 to
5c6dd85
Compare
5c6dd85 to
ca06931
Compare
3ab242c to
621c3a3
Compare
621c3a3 to
307ec62
Compare
307ec62 to
bd33f26
Compare
bd33f26 to
13548ba
Compare
ee68feb to
94240b6
Compare
94240b6 to
4b85a3f
Compare
The test runs a webpack production build. On the Node 20 CI runners it takes 3 to 5 seconds, close to the 5 second default timeout, and some runs time out. Locally it takes about 0.3 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove `nodeLinker: hoisted` and `shamefullyHoist`, so pnpm installs its default isolated layout. Each package now resolves only the dependencies that it or the root package.json declares. - Packages declare the dependencies that they imported from the hoisted root folder, with the version that the root folder had. The lockfile gets no new versions. - `tslib` is a root devDependency, because the shared tsconfig sets `importHelpers`. - @sentry/replay declares `@sentry/conventions` as a devDependency, so its build still inlines the constant that it imports from there. - react-router, solidstart, sveltekit and tanstackstart-react declare `@types/node` 18 like the root. Without it, the optional `@types/node` peer of Vite resolves to version 20, and the Vite plugin types of @sentry/server-utils do not match. - `packageExtensions` declares the bundlers as optional peers of @apm-js-collab/code-transformer-bundler-plugins, because its type declarations import them. - rollup-utils reads the `sideEffects` field of an external package from the nearest node_modules folder of the built package, not only from the root folder. Without this, the builds keep empty imports of packages that are not in the root folder, for example `import '@sentry/core'`. - The integration test runner adds the bins of node-integration-tests to the `PATH` of setup commands such as `prisma generate`, because the Bun and Deno packages run the shared suites with their own `PATH`. - The install-playwright action runs `npx playwright` outside the repository. In the repository, npm finds the playwright version in `node_modules/.pnpm` and then runs `node_modules/.bin/playwright`, which the root folder no longer has. - The size limit of `@sentry/cloudflare (withSentry)` goes from 514 KiB to 515 KiB. This check bundles without minification, so the bundle keeps the module paths, which are about 4 KB longer under `node_modules/.pnpm`. The code in the bundle is the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root package.json listed every workspace package as a `workspace:*` devDependency, so that each package could import any of them from the root node_modules folder like with Yarn. Remove these entries and declare the workspace packages in the packages that import them, for example `@sentry-internal/rollup-utils` in the rollup configs. The root keeps three of them: - `@sentry-internal/node-integration-tests`, because its suites import it by its own name, also from tmp folders that have their own package.json. - `@sentry/eslint-plugin-sdk`, because the root oxlint config loads it as a JS plugin. - `@sentry/sveltekit`, because size-limit bundles its build output, which imports `@sentry/sveltekit/browser-tracing-variant`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4b85a3f to
26a1ddf
Compare
isaacs
left a comment
There was a problem hiding this comment.
Some minor nits, but this mostly looks good to go.
| }, | ||
| "devDependencies": { | ||
| "premove": "^4.0.0", | ||
| "sentry": "^0.44.0", |
There was a problem hiding this comment.
Thinking this should probably match the lockfile and @sentry/bundler-plugins deps, yeah?
| "sentry": "^0.44.0", | |
| "sentry": "^0.45.0", |
| "meriyah": "^6.1.4", | ||
| "vite": "^8.3.1" | ||
| "vite": "^8.3.1", | ||
| "webpack": "^5.0.0" |
There was a problem hiding this comment.
| "webpack": "^5.0.0" | |
| "webpack": "^5.104.1" |
| sideEffectFree = json.sideEffects === false; | ||
| } catch { | ||
| // Not resolvable from the repo root - assume side effects. | ||
| // Not resolvable from the built package - assume side effects. |
There was a problem hiding this comment.
findPackageJson (down a few lines from here) walks from process.cwd() up to the repo root. If no node_modules/<name>/package.json exists, it returns the root candidate, readFileSync throws, and the package counts as having side effects.
The commit message says this exact fallback caused leftover import '@sentry/core' statements in builds before the fix. With the isolated layout, the fallback now happens whenever a package imports an external that it does not declare directly. The build still succeeds, but the output changes.
Suggestion: log a warning in the catch here, whenever the package is not a Node builtin. Then the next undeclared import shows up in the build log instead of in a later diff of the build output.
| @@ -4,7 +4,7 @@ import { cp, mkdir, readFile, rm, writeFile } from 'fs/promises'; | |||
| import { basename, join } from 'path'; | |||
There was a problem hiding this comment.
| import { basename, join } from 'path'; | |
| import { basename, join, delimiter } from 'path'; |
| // The Bun and Deno packages run these suites with their own `PATH`, which does not have the bins of | ||
| // this package (e.g. `prisma`). | ||
| const binPaths = [join(tmpDirPath, 'node_modules', '.bin'), join(PACKAGE_ROOT, 'node_modules', '.bin')]; | ||
| const env = { ...process.env, PATH: `${binPaths.join(':')}:${process.env.PATH}` }; |
There was a problem hiding this comment.
':' is posix-only. Windows uses ';'. Import path.delimiter and use that instead.
| const env = { ...process.env, PATH: `${binPaths.join(':')}:${process.env.PATH}` }; | |
| const env = { ...process.env, PATH: `${binPaths.join(delimiter)}:${process.env.PATH}` }; |
|
|
||
| # Dependencies that import packages without declaring them. pnpm links these peers to the versions of the importer. | ||
| packageExtensions: | ||
| # Its type declarations import the bundler types. |
There was a problem hiding this comment.
The description says "the real fix belongs upstream".
Suggestion: open an issue on @apm-js-collab/code-transformer-bundler-plugins and link it in the YAML comment here.
This moves the monorepo from the hoisted
node_moduleslayout to the isolated pnpm default. Each package now declares the packages that it imports, instead of using what the root folder had. A full build gives the same files as with the hoisted layout.package.jsonno longer lists every workspace package asworkspace:*. Each package declares the workspace packages that it imports, for example@sentry-internal/rollup-utilsin the rollup configs. The root keeps three of them:@sentry-internal/node-integration-tests(its suites import it by name, also from tmp folders with their ownpackage.json),@sentry/eslint-plugin-sdk(oxlint plugin) and@sentry/sveltekit(size-limit bundles its self-import).@sentry/replaydeclares@sentry/conventionsas a dev dependency, so its build still inlines the constant from there.sideEffectsfield of external packages from the nearestnode_modulesof the built package, not only from the root folder.PATHof setup commands (for exampleprisma generate), because the Bun and Deno packages run the shared suites with their ownPATH.npx playwrightoutside the repository. In the repository, npm finds that version innode_modules/.pnpmand then looks fornode_modules/.bin/playwright, which the root folder no longer has.SDK fix
modulesIntegrationdid not find the versions of CJS modules in the isolated pnpm layout (node_modules/.pnpm/<id>/node_modules/<name>), so pnpm apps got the version ranges of theirpackage.jsoninstead. It now reads these folders too. Thesuites/modulesCJS test covers it, because it now runs on this layout.packageExtensions decisions
@apm-js-collab/code-transformer-bundler-pluginsimports the types of Vite, Rollup, webpack and esbuild without declaring them.pnpm-workspace.yamldeclares them as optional peers, so its types use the Vite of the importing package. The real fix belongs upstream.Peer decisions
autoInstallPeersstaysfalse. The pnpm default (true) adds 674 package versions for peers that no package needs, for example@glimmer/componentand the GraphQL tools of Gatsby.Known issues
@sentry/cloudflare (withSentry)entry, but it stays under the 516 KiB limit of develop. Some other entries change by up to 200 bytes. The bundled code is the same, but the bundles contain the longernode_modules/.pnpm/...file paths.