Skip to content

Add upload option to sourcemaps config#2918

Open
joeriddles wants to merge 2 commits intoPostHog:mainfrom
joeriddles:add-sourcemap-no-upload
Open

Add upload option to sourcemaps config#2918
joeriddles wants to merge 2 commits intoPostHog:mainfrom
joeriddles:add-sourcemap-no-upload

Conversation

@joeriddles
Copy link

@joeriddles joeriddles commented Jan 16, 2026

Problem

People who want to upload source maps to PostHog in a separate CI workflow than their build process.

Source map uploading is slow and can be ran parallel in a separate workflow.

Changes

Add upload option to the Next.js/Rollup/Webpack sourcemaps config. When false, posthog-cli sourcemap inject is used. When true (default), @posthog/cli sourcemap process is used, which injects and uploads.

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react
  • @posthog/ai
  • @posthog/nextjs-config
  • @posthog/nuxt
  • @posthog/rollup-plugin
  • @posthog/webpack-plugin
  • @posthog/types

Checklist

  • Tests for new code
    • There are no existing tests for any of the modified packages
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
    • Default option is to upload sourcemaps
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file
  • Added the "release" label to the PR to indicate we're publishing new versions for the affected packages

@vercel
Copy link

vercel bot commented Jan 16, 2026

@joeriddles is attempting to deploy a commit to the PostHog Team on Vercel.

A member of the Team first needs to authorize it.

@joeriddles joeriddles marked this pull request as ready for review January 16, 2026 17:39
@joeriddles joeriddles requested a review from a team as a code owner January 16, 2026 17:39
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (3)

  1. packages/rollup-plugin/src/index.ts, line 89-94 (link)

    logic: deleteAfterUpload and batchSize only apply when uploading - these checks should be inside the if (posthogOptions.sourcemaps.upload) block, since sourcemap inject doesn't support these flags

  2. packages/webpack-plugin/src/index.ts, line 87-93 (link)

    logic: deleteAfterUpload and batchSize only apply when uploading - these checks should be inside the if (config.sourcemaps.upload) block, since sourcemap inject doesn't support these flags

  3. packages/nextjs-config/src/utils.ts, line 38-44 (link)

    logic: deleteAfterUpload and batchSize only apply when uploading - these checks should be inside the if (posthogOptions.sourcemaps.upload) block, since sourcemap inject doesn't support these flags

4 files reviewed, 8 comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (2)

  1. packages/webpack-plugin/src/index.ts, line 87-93 (link)

    syntax: wrap these checks in if (config.sourcemaps.upload) conditional - when upload is false, deleteAfterUpload and batchSize don't exist on the discriminated union type

  2. packages/nextjs-config/src/utils.ts, line 37-43 (link)

    syntax: wrap these checks in if (posthogOptions.sourcemaps.upload) conditional - when upload is false, deleteAfterUpload and batchSize don't exist on the discriminated union type

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@joeriddles
Copy link
Author

I'm having a hard time testing this in a separate project with my forked branch. I didn't see any advice in CONTRIBUTING.md for testing forked versions of this repo. I'm running into issues since the internal packages use workspace:* for dependencies on other internal packages. Any advice here?

@@ -15,7 +15,15 @@ export function hasCompilerHook(): boolean {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeriddles Just to be sure to understand the use case, do you want to build once and upload sourcemaps in multiple environments in parallel ? What is the workflow you want to achieve ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any errors when you run 'pnpm install' in the workspace ?

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions bot added the stale label Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants