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

Open
wants to merge 17 commits into
base: feat/type-safe-ph-extensions
Choose a base branch
from

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 19, 2024 9:56am

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 164 kB +676 B (+0.41%)
dist/main.js 165 kB +676 B (+0.41%)
dist/module.js 164 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 163 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 163 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 🤣

@y3fers0n
Copy link

Any updates? Thanks you

…ipts-option

# Conflicts:
#	src/utils/globals.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants