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

Make script loading async? #5

Closed
KyleAMathews opened this issue Jan 29, 2018 · 12 comments
Closed

Make script loading async? #5

KyleAMathews opened this issue Jan 29, 2018 · 12 comments

Comments

@KyleAMathews
Copy link

Currently you're adding the script into the head which will block the page loading until the script is downloaded.

/cc @mickeyreiss-visor

@KyleAMathews
Copy link
Author

Want to add sentry support to gatsbyjs.org but need this fixed first :-)

Also @mickeyreiss-visor's PR looks good to me.

Oh and here's a long issue about this getsentry/sentry-javascript#169

@KyleAMathews
Copy link
Author

Possibly one of the solutions there could be a good fit.

@sedubois
Copy link

@KyleAMathews did you workaround this somehow or you still don't have Sentry in Gatsbyjs.org?

@gilesbutler
Copy link

Interested to hear if you got this going too @KyleAMathews.

We had to turn Sentry off due to lots of errors coming from the Gatsby generated code.

@octalmage
Copy link
Owner

Thanks guys! I'll take a look at making it async.

@octalmage
Copy link
Owner

@gilesbutler I get a good number of errors as well on my site, but they are legit errors that mean that the user had to click a link twice or something like that. I think it's worth keeping it enabled to check out.

@KyleAMathews
Copy link
Author

Oh, instead of pulling it from a CDN, this plugin should just add it directly via their NPM package https://docs.sentry.io/clients/javascript/install/#npm

onClientEntry makes this sort of thing pretty easy for a plugin to do https://www.gatsbyjs.org/docs/browser-apis/#onClientEntry

@octalmage
Copy link
Owner

There's related talk in #6 about how to pull the library in. I agree and I'd like to get it to pull from npm. I just copied the Google Analytics plugin to get Sentry loading on my site.

@humphreybc
Copy link

@octalmage Any update on pulling from NPM?

michelemazzucco referenced this issue in michelemazzucco/gatsby-plugin-sentry Jun 4, 2018
@Thien42
Copy link
Contributor

Thien42 commented Jun 13, 2018

I sent a pull request regarding the loading from NPM instead of the CDN #9

@abumalick
Copy link

abumalick commented Jun 20, 2018

I have to remove the plugin because of that, scripts are usually never added to the <head>

@octalmage
Copy link
Owner

Version v0.1.0 has been published to npm which resolves this, and it's also been deployed to my site https://jason.stallin.gs and appears to be working. Got some errors related to cached bundles so I got to see it work in production.

Thanks everyone!

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

7 participants