Unverified Commit d15a4d5c authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

[Fast Refresh] Cleaner Console Output (#12745)

parent 6972a09f
...@@ -246,6 +246,8 @@ function onFastRefresh(hasUpdates) { ...@@ -246,6 +246,8 @@ function onFastRefresh(hasUpdates) {
DevOverlay.onRefresh() DevOverlay.onRefresh()
} }
} }
console.log('[Fast Refresh] done')
} }
// There is a newer version of the code available. // There is a newer version of the code available.
...@@ -260,9 +262,7 @@ function processMessage(e) { ...@@ -260,9 +262,7 @@ function processMessage(e) {
switch (obj.action) { switch (obj.action) {
case 'building': { case 'building': {
++hmrEventCount ++hmrEventCount
console.log( console.log('[Fast Refresh] rebuilding')
'[HMR] bundle ' + (obj.name ? "'" + obj.name + "' " : '') + 'rebuilding'
)
break break
} }
case 'built': case 'built':
...@@ -379,10 +379,18 @@ function tryApplyUpdates(onHotUpdateSuccess) { ...@@ -379,10 +379,18 @@ function tryApplyUpdates(onHotUpdateSuccess) {
function handleApplyUpdates(err, updatedModules) { function handleApplyUpdates(err, updatedModules) {
if (err || hadRuntimeError || !updatedModules) { if (err || hadRuntimeError || !updatedModules) {
if (err) { if (err) {
console.warn('Error while applying updates, reloading page', err) console.warn(
} '[Fast Refresh] performing full reload\n\n' +
if (hadRuntimeError) { "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React tree.\n" +
console.warn('Had runtime error previously, reloading page') 'You might have a file which renders a React component but also exports a value that is imported by a non-React component.\n' +
'Consider migrating the non-React component export to a separate file and importing it into both files.\n\n' +
'It is also possible you are using class components at the top-level of your application, which disables Fast Refresh.\n' +
'Fast Refresh requires at least one function component in your React tree.'
)
} else if (hadRuntimeError) {
console.warn(
'[Fast Refresh] performing full reload because your application had an unrecoverable error'
)
} }
window.location.reload() window.location.reload()
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment