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

reportWebVitals seems to disable fast refresh in some cases #12906

Closed
chrisdrackett opened this issue May 15, 2020 · 4 comments
Closed

reportWebVitals seems to disable fast refresh in some cases #12906

chrisdrackett opened this issue May 15, 2020 · 4 comments
Assignees
Labels
locked Webpack Related to Webpack with Next.js.

Comments

@chrisdrackett
Copy link

Bug report

Describe the bug

I'm still working through this and have yet to reproduce in a small example. In our app if you add

export function reportWebVitals(metric) {
  console.log(metric)
}

to _app.tsx fast refresh will no longer work for some components. Take the above out and it appears to work for everything.

@Timer Timer added the please add a complete reproduction Please add a complete reproduction. label May 15, 2020
@Timer
Copy link
Member

Timer commented May 15, 2020

Happy to take a look if you provide a demo!

@chrisdrackett
Copy link
Author

ok, was able to recreate this on a small scale. I wonder if this is related to our other issues.

in this branch: https://github.com/chrisdrackett/next-external-test/tree/broken

if you comment out the code here: https://github.com/chrisdrackett/next-external-test/blob/broken/web/pages/_app.tsx#L7

fast refresh will work (when editing https://github.com/chrisdrackett/next-external-test/blob/broken/external/src/Wrapper.tsx), if you leave it in editing the same file will result in a full refresh

@Timer Timer added this to the 9.4.2 milestone May 19, 2020
@Timer Timer added Type: Needs Investigation and removed please add a complete reproduction Please add a complete reproduction. labels May 19, 2020
@Timer Timer modified the milestones: 9.4.2, 9.4.x May 19, 2020
@Timer Timer self-assigned this Jul 27, 2020
@styfle styfle modified the milestones: 11.x.x, 12.0.4 Nov 5, 2021
@timneutkens timneutkens removed this from the 12.0.5 milestone Nov 17, 2021
@timneutkens timneutkens added the Webpack Related to Webpack with Next.js. label Nov 18, 2021
@imranbarbhuiya
Copy link
Contributor

I'm experiencing this issue. In nextjs v12, if I edit _app.tsx, my fast refresh wasn't working but for other pages, it was working. As I don't edit _app.tsx much so I had no issue. But after upgrading to nextjs v13, any page I edit, it's performing a full refresh. I was confused about why it was happening. At first, I thought it might be due to I was using both /app and /pages dir but later I checked all my pages to make sure I'm not exporting any fs along with jsx element and found that only _app.tsx exports reportWebVitals function. I removed it and everything is working fine.

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Webpack Related to Webpack with Next.js.
Projects
None yet
Development

No branches or pull requests

6 participants