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

Self-hosting jQuery instead of delivering from public CDN #17318

Closed
Tracked by #17645
tnir opened this issue Apr 18, 2022 · 6 comments
Closed
Tracked by #17645

Self-hosting jQuery instead of delivering from public CDN #17318

tnir opened this issue Apr 18, 2022 · 6 comments

Comments

@tnir
Copy link
Contributor

tnir commented Apr 18, 2022

cc @pavelloz

For performance reasons I would highly recommend self-hosting everything, especially javascripts that are in the Time To Interactive path. jQuery might be one of those scripts that is needed for navigation to work.

Originally posted by @pavelloz in #17205 (comment)

@github-actions
Copy link
Contributor

Thanks for the issue, we will take it into consideration! Our team of engineers is busy working on many types of features, please give us time to get back to you.

Feature requests that require more discussion may be closed. Read more about our feature request process on forem.dev.

To our amazing contributors: issues labeled bug are always up for grabs, but for feature requests, please wait until we add a ready for dev before starting to work on it.

To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please ping @forem-team. The OSS Community Manager or the engineers on OSS rotation will follow up.

For full info on how to contribute, please check out our contributors guide.

@tnir
Copy link
Contributor Author

tnir commented May 13, 2022

@pavelloz Do you want to work on this? I do not think delivering (jQuery) script from self-hosting than public CDN makes site faster, but can you rationalize it? If not, I am inclined to close this.

jQuery is only used on (1) video uploader and (2) /admin.

@pavelloz
Copy link

pavelloz commented May 13, 2022

Self-hosting:

  1. eliminates SSL handshake to 3rd party domain (speed)
  2. removes the risk of it being replaced by malicious script (security) - this is mitigated by integrity hash
  3. does not interact with 3rd party host, so doesnt allow CDN to track your visitors (privacy)

In general everything that can be self-hosted, should be self hosted. :)

I can try tackling that one :)

@pavelloz
Copy link

pavelloz commented May 13, 2022

Ok i give up.

I dont have time to fight with rails convoluted mechanisms to include js and css, i hope its easy to see what needs to be done and how to do it safely based on my try: #17672

@tnir
Copy link
Contributor Author

tnir commented May 14, 2022

@pavelloz I really appreciate your trial 🎉 . As far as we use webpack/webpacker, bundling time would be slower, which causes bad developer experience compared with performance gain. In-browser caching will be skipped, I think.

@tnir tnir closed this as completed May 14, 2022
@pavelloz
Copy link

pavelloz commented May 14, 2022

Compiling those 100KB wont be noticed. Look at your builds (14 minutes), if it goes up by 0.2 second in webpack, it would be worst case scenario.
Im 100% sure its worth it, i do it for the past X years, the best experts on performance recommend it, but you do you. Good luck. xo

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

No branches or pull requests

2 participants