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: Improved various bundles #1265

Merged
merged 16 commits into from
Jun 28, 2024
Merged

feat: Improved various bundles #1265

merged 16 commits into from
Jun 28, 2024

Conversation

benjackwhite
Copy link
Collaborator

@benjackwhite benjackwhite commented Jun 21, 2024

Changes

  • Refactor entrypoints so that they are clearer and more automatable
  • Sadly couldn't just user the file extensions .mts as tsc doesn't like it so used a sub extension to indicate target
  • Add more stuff to the full file
  • Adds a config option for explicitly stating that you never want to load external scripts

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!)

Copy link

vercel bot commented Jun 21, 2024

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Jun 26, 2024 2:27pm

@posthog-bot
Copy link
Collaborator

Hey @benjackwhite! 👋
This pull request seems to contain no description. Please add useful context, rationale, and/or any other information that will help make sense of this change now and in the distant Mars-based future.

Copy link

github-actions bot commented Jun 21, 2024

Size Change: -135 kB (-10.83%) 👏

Total Size: 1.11 MB

Filename Size Change
dist/array.full.js 315 kB +68.5 kB (+27.83%) 🚨
dist/array.js 143 kB +311 B (+0.22%)
dist/es.js 0 B -143 kB (removed) 🏆
dist/module.js 143 kB -441 B (-0.31%)
dist/recorder-v2.js 109 kB -62 B (-0.06%)
dist/surveys-module-previews.js 0 B -60.3 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 10.4 kB
dist/main.js 144 kB
dist/recorder.js 109 kB
dist/surveys-preview.js 60.3 kB
dist/surveys.js 65 kB
dist/tracing-headers.js 8.26 kB
dist/web-vitals.js 5.79 kB

compressed-size-action

@benjackwhite benjackwhite requested a review from pauldambra June 21, 2024 08:40
@benjackwhite benjackwhite marked this pull request as ready for review June 21, 2024 08:40
@benjackwhite benjackwhite added the bump patch Bump patch version when this PR gets merged label Jun 21, 2024
@benjackwhite benjackwhite removed the bump patch Bump patch version when this PR gets merged label Jun 24, 2024
Comment on lines +26 to +27
"main": "dist/main.js",
"module": "dist/module.js",
Copy link
Member

Choose a reason for hiding this comment

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

ELI5?

(i have managed to ignore changes to JS bundling over the last few chaotic years 🤣)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we just had it poorly named beforehand. The module wasn't really the module loader 🤷

@pauldambra
Copy link
Member

feels like there are some QoL improvements you could pull out of this (like the loadScript refactor) that would make it easier to ship them and then easier to review this 🙈

@benjackwhite
Copy link
Collaborator Author

feels like there are some QoL improvements you could pull out of this (like the loadScript refactor) that would make it easier to ship them and then easier to review this 🙈

That's fair. Didn't want to spend too much time here... But yeah I can split out the bundle changes from the functional changes

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.

runs locally

@pauldambra
Copy link
Member

That's fair. Didn't want to spend too much time here... But yeah I can split out the bundle changes from the functional changes

depends... it runs locally for me, so might be easier to just ship it 🙈

@pauldambra
Copy link
Member

Screenshot 2024-06-26 at 15 31 49

this removal ok?

@pauldambra
Copy link
Member

i suppose only risk here is someone is importing from dist/es.js and their build breaks when updating?

@benjackwhite
Copy link
Collaborator Author

i suppose only risk here is someone is importing from dist/es.js and their build breaks when updating?

I think thats fine, especially as it is npm only in that case so they would have the minor upgrade and we don't document that as an option anywhere

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants