-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix order of init and imports for react onboarding #10020
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bundle ReportChanges will decrease total bundle size by 12 bytes ⬇️
|
// Make sure Sentry.init() is called before importing any of your other code | ||
import App from "./App"; | ||
import { createRoot } from "react-dom/client"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't all imports are evalulated first, regardless where they appear in the file? Thought you would need to make a separate file for sentry, and import it first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends a bit on what the bundlers will do, but I think you are right. Vite seems to hoist the import statements up. I will update. Thanks!
import { | ||
createRoutesFromChildren, | ||
matchRoutes, | ||
useLocation, | ||
useNavigationType, | ||
} from "react-router-dom"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were missing these
// Make sure Sentry.init() is called before importing any of your other code | ||
import App from "./App"; | ||
import { createRoot } from "react-dom/client"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends a bit on what the bundlers will do, but I think you are right. Vite seems to hoist the import statements up. I will update. Thanks!
Co-authored-by: vivianyentran <20403606+vivianyentran@users.noreply.github.com>
Ref: getsentry/sentry-javascript#12018 (comment)