-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Browser lib contains variable "chrome" that conflicts with the global "chrome" variable #6880
Comments
Hey @wesleyyee, thanks for writing in. I tried to reproduce this, but was unable to: https://codesandbox.io/s/global-chrome-variable-config-jpu1bm?file=/src/index.js. Could you give some details about how you are bundling you application, and what your bundler config looks like? It would be great if you could provide a reproduction of this issue to help us debug further. |
Thanks @AbhiPrasad we are using rollup to bundle and the config looks like
|
this seems to be the variable that collides with the global chrome object |
The Maybe you have to dedupe your sentry imports if there are duplicates appearing? From looking around I can only see SAP/ui5-webcomponents#4978 which hit a similar problem (also with rollup). Do you know what else in your app could be declaring a global chrome object? If you can probably find this by searching through your final generated bundle. |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Could you please review link from @wesleyyee where chrome: is defined. We also had issue with Vite option that disables identifier minification that raised "chrome" conflict with global chrome variable |
This link: https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/stack-parsers.ts#L37 does not lead to anything chrome related anymore. If you're still seeing an issue, could you open a new issue with as much info as possible, so we can take a look at reproducing/fixing the issue? thank you! |
This is breaking my brain a little bit, but to unblock I opened #10874 - but I think that is not the long term solution.
@dmajkic mind elaborating why you're doing this? It does increase bundle size substantially. |
resolves #6880 Using `const chrome = ...` or similar breaks certain setups based on their bundler config. This makes changes to browser code so that we never declare a variable named `chrome`. I tried setting up https://eslint.org/docs/latest/rules/id-denylist to enforce this, but this unfortunately also looks as types declarations (so `type K = { chrome: ... }` is problematic.
resolves #6880 Using `const chrome = ...` or similar breaks certain setups based on their bundler config. This makes changes to browser code so that we never declare a variable named `chrome`. I tried setting up https://eslint.org/docs/latest/rules/id-denylist to enforce this, but this unfortunately also looks as types declarations (so `type K = { chrome: ... }` is problematic.
Released https://github.com/getsentry/sentry-javascript/releases/tag/7.106.0 which should address this. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/browser
SDK Version
7.31.1
Framework Version
No response
Link to Sentry event
No response
SDK Setup
import * as Sentry from '@sentry/browser';
import { BrowserTracing } from '@sentry/tracing';
Sentry.init({
dsn: SENTRY_DSN,
integrations: [new BrowserTracing()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: isProduction ? 0.5 : 1.0,
});
Steps to Reproduce
Expected Result
No conflicting variable
Actual Result
Uncaught SyntaxError: Identifier 'chrome' has already been declared
The text was updated successfully, but these errors were encountered: