-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add Push plugin to cdn #1861
Add Push plugin to cdn #1861
Conversation
WalkthroughThe changes involve modifications to the build process within the Changes
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (4)
Files skipped from review as they are similar to previous changes (3)
Additional context usedLanguageTool
Markdownlint
Additional comments not posted (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far, couple of suggestions. Also, worth updating the README as part of this PR?
Yeah, good idea. Will add the section to Push plugin about using it from CDN |
f8bdf9d
to
f6dfaaa
Compare
Added readme in a80ff5f |
f6dfaaa
to
a80ff5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
See internal slack discussion: https://ably-real-time.slack.com/archives/CURL4U2FP/p1723454752656739.
We can't use existing push plugin build output as it has
ulid
as external and it tries to import it as a commonjs module. Found the reasoning for this here, with ref to the esbuild docs:This means that for the use of push plugin via script tag from CDN, we would need to either polyfill the
require
call, or add some wrapper/replacerequire('ulid')
call withwindow.ulid
(potentially doable with https://github.com/yanm1ng/esbuild-plugin-external-global#readme, but quick test locally didn't produce expected result - it end up callingrequire
anyway).All of the above would mean having a separate file for push plugin for CDN use anyway, so at this point it's just easier to bundle
ulid
together with push plugin for CDN specifically, and publish that.This way CDN users get easy use of the Push plugin (no need to also include
ulid
via CDN), and users that use npm still have access to the push plugin file without extra code (saves ~1kb gzipped).Summary by CodeRabbit
New Features
Bug Fixes
Performance Improvements