Giter Club home page Giter Club logo

Comments (7)

joshmcarthur avatar joshmcarthur commented on August 11, 2024

@eoinkelly I think probably the application pack should be the deferred one. Perhaps we could have another pack named something like "boot" that is non-deferred. This would encourage code to be placed in deferred scripts unless it had to be in the startup pack.

from rails-template.

eoinkelly avatar eoinkelly commented on August 11, 2024

That's a good idea @joshmcarthur

from rails-template.

eoinkelly avatar eoinkelly commented on August 11, 2024

Some evidence for defer by default being good: I have recently changed a few of our apps to defer application JS and it mostly just works. The only change I had to make was in an older app but it was an easy refactor.

from rails-template.

eoinkelly avatar eoinkelly commented on August 11, 2024

Re @joshmcarthur suggestion about a second pack. I was initially in favour of that but I'm not so sure now because I think it would end up being an empty file and a useless HTTP request in production on most apps.

I now think the right approach is:

  1. load the main pack with defer
  2. Put a big comment at the top of the main pack explaining what that means and how to create a "boot" (non deferred) pack if you need it for some reason

Thoughts?

from rails-template.

joshmcarthur avatar joshmcarthur commented on August 11, 2024

from rails-template.

eoinkelly avatar eoinkelly commented on August 11, 2024

Reading https://docs.sentry.io/platforms/javascript/

It’s possible to include defer in your script tag, but keep in mind that any errors which occur in scripts that execute before the browser SDK script executes won’t be caught (because the SDK won’t be initialized yet). We strongly recommend that if you use defer, you a) place the script tag for the browser SDK first, and b) mark it, and all of your other scripts, defer (but not async), thereby guaranteeing that it’s executed before any of the others.

I think we should be OK provided we init Sentry before we load any other JS.

from rails-template.

Rabid-Dan avatar Rabid-Dan commented on August 11, 2024

resolved by #141

from rails-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.