CommonJs and Sentry Browser

should i use @sentry/node@4.1.1 or @sentry/browser@4.1.1 ?
while using Raven-js i use it like

window.Raven = require("raven-js");

Raven.config(process.env.MIX_SENTRY_DSN, {
	release: process.env.MIX_APP_HASH,
	environment: process.env.MIX_NODE_ENV,
}).install();

i tried browser(es6) import, but it does not register Sentry as global var.

Use @sentry/browser@4.1.1 alternatively you can use our CDN hosted version.

<script src="https://browser.sentry-cdn.com/4.1.1/bundle.min.js" crossorigin="anonymous"></script>

window.Sentry is available then.

1 Like

Thanks, I tried window.Sentry = Sentry.init({}) as well but it does not work either. (was expecting window.Sentry = New Sentry({}) could work )

In the end I added window.Sentry = Sentry; after saw your reply, and it’s finally working in other .js file.