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

feat: Bundle option without any external scripts #1413

Merged
merged 31 commits into from
Sep 23, 2024

Conversation

benjackwhite
Copy link
Collaborator

@benjackwhite benjackwhite commented Sep 11, 2024

Changes

Builds on top of @pauldambra 's great external scripts typing work and makes the external deps loader a separate extension that we can then include depending on the bundle

This allows someone to import specific modules such as

// No external module loading bundled
import posthog from 'posthog-js/dist/module.no-external'
// All external modules pre-bundled but still allows external things like site apps
import posthog from 'posthog-js/dist/module.full'
// All external modules pre-bundled and no external loading possible
import posthog from 'posthog-js/dist/module.full.no-external'

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)
    …ut it

Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Sep 20, 2024 10:45am

Copy link

github-actions bot commented Sep 11, 2024

Size Change: +2.71 kB (+0.1%)

Total Size: 2.79 MB

Filename Size Change
dist/array.full.js 349 kB +683 B (+0.2%)
dist/array.js 165 kB +676 B (+0.41%)
dist/main.js 165 kB +676 B (+0.41%)
dist/module.js 165 kB +676 B (+0.41%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 191 kB
dist/array.full.no-external.js 348 kB
dist/array.no-external.js 164 kB
dist/exception-autocapture.js 10.5 kB
dist/external-scripts-loader.js 2.35 kB
dist/module.full.js 349 kB
dist/module.full.no-external.js 348 kB
dist/module.no-external.js 164 kB
dist/recorder-v2.js 111 kB
dist/recorder.js 111 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.36 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

@pauldambra
Copy link
Member

oh, well now I need to test the external scripts typing PR... that's not fair 🤣

…ipts-option

# Conflicts:
#	src/utils/globals.ts
Base automatically changed from feat/type-safe-ph-extensions to main September 20, 2024 10:23
An error occurred while trying to automatically change base from feat/type-safe-ph-extensions to main September 20, 2024 10:23
@benjackwhite benjackwhite added release alpha NB _when applied_ release an alpha version to NPM bump minor Bump minor version when this PR gets merged labels Sep 20, 2024
Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

running locally all seems good
no-external bundle excludes the remote loading code

i think we're good to go

@pauldambra pauldambra added release alpha NB _when applied_ release an alpha version to NPM and removed release alpha NB _when applied_ release an alpha version to NPM labels Sep 21, 2024
@benjackwhite benjackwhite merged commit 8880713 into main Sep 23, 2024
16 checks passed
@benjackwhite benjackwhite deleted the feat/no-external-scripts-option branch September 23, 2024 13:13
@y3fers0n
Copy link

Can we have a new release? Thank you

@DophinL
Copy link

DophinL commented Sep 24, 2024

Can we have a new release? Thank you

+1

@davidfurlong
Copy link

Can we have a new release? Thank you

+1

there is one, https://github.com/PostHog/posthog-js/releases/tag/v1.164.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged release alpha NB _when applied_ release an alpha version to NPM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants