You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Injecting Raven using anonymous script no longer works #635
I remember that just pasting the raven-js code into the Chrome console would cause Raven to be added to window, but now that doesn't work. Even doing something like this doesn't result in window.Raven being defined.
@benvinegar It's probably not the desired solution, but removing the entire else if section that detects define from the minified block at the top allowed me to inject into the page directly. Testing now whether or not it actually functions as expected.
Yeah, the new [UMD header](introduced in 2.0) assumes that if you are using requirejs, you should use requirejs to load raven-js. This doesn't work if you just load it anonymously via the CDN.
Be sure to load all scripts that call define() via the RequireJS API. Do not manually code script tags in HTML to load scripts that have define() calls in them.
So, if we want this to work, we'll need both raven-umd[.min].js and raven[.min].js. OR we are going to just accept that the CDN build is just completely different from the bower/npm builds, and doesn't bother with the UMD header since it can't be used as a module as an anonymous script anyways. I'm leaning towards the latter.
Although it's probably worth mentioning that if you are using requirejs, you should probably just add raven-js as a dependency via npm or bower, rather than go through the CDN.
@benvinegar ha, I knew someone would say it! It's really just for the benefit of injecting into arbitrary pages, some of which may have requirejs. I do agree it's a bit odd to not be able to drop it into the page. I assume the call to define in the top block does work when loaded properly from requirejs?
Activity
mlb5000 commentedon Jun 30, 2016
This seems to be an issue with
requirejs...does this not work whenrequireis present anymore?mlb5000 commentedon Jun 30, 2016
This appears to have broken as of v1.2.0
benvinegar commentedon Jun 30, 2016
Thanks for letting us know – I'll take a look.
mlb5000 commentedon Jun 30, 2016
@benvinegar It's probably not the desired solution, but removing the entire
else ifsection that detectsdefinefrom the minified block at the top allowed me to inject into the page directly. Testing now whether or not it actually functions as expected.benvinegar commentedon Jun 30, 2016
Yeah, the new [UMD header](introduced in 2.0) assumes that if you are using requirejs, you should use requirejs to load raven-js. This doesn't work if you just load it anonymously via the CDN.
From the requirejs docs:
So, if we want this to work, we'll need both raven-umd[.min].js and raven[.min].js. OR we are going to just accept that the CDN build is just completely different from the bower/npm builds, and doesn't bother with the UMD header since it can't be used as a module as an anonymous script anyways. I'm leaning towards the latter.
benvinegar commentedon Jun 30, 2016
Although it's probably worth mentioning that if you are using requirejs, you should probably just add raven-js as a dependency via npm or bower, rather than go through the CDN.
mlb5000 commentedon Jul 1, 2016
@benvinegar ha, I knew someone would say it! It's really just for the benefit of injecting into arbitrary pages, some of which may have requirejs. I do agree it's a bit odd to not be able to drop it into the page. I assume the call to
definein the top block does work when loaded properly from requirejs?benvinegar commentedon Jul 7, 2016
It should.
I've opened a ticket about dropping the define/require stuff from the CDN build: #644
benvinegar commentedon Jul 7, 2016
Closing issue in favor of #644.
feat(browser-utils): bump web-vitals to 5.1.0 (#18091)