You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dynamicComponent(newSameLoopPromise(cb),{ssr: false})// NB: Not sure what 5 corresponds to...cb=function(resolve,reject){require.ensure(5).then(require=>{try{require('./pages/test.js')resolve(m)}catch(error){reject(error)}}).catch(__webpack_require__.oe)}
Now, if our require throws an error (e.g. ReferenceError):
reject is called, but in dynamicComponent#loadComponent() as seen above, there is nothing to catch it.
Also, the .catch(__webpack_require__.oe) after require.ensure is never called either because our require is wrapped in its own try catch.
Solution
Add }).catch(e => console.error(e)) at the end of dynamicComponent#loadComponent().
Your Environment
Tech
Version
next
6.0.0
node
8.1.2
OS
macOS
browser
Chrome
etc
The text was updated successfully, but these errors were encountered:
Notice how
promise.then()
is called without a.catch()
.https://github.com/zeit/next.js/blob/e093441bad588e98765a05df90f76f75283eda07/lib/dynamic.js#L56-L74
In my code I have this line:
Which transpiles to this via the
handle-import
babel plugin:Which cleaned up looks like this:
Now, if our
require
throws an error (e.g.ReferenceError
):reject
is called, but indynamicComponent#loadComponent()
as seen above, there is nothing to catch it..catch(__webpack_require__.oe)
afterrequire.ensure
is never called either because our require is wrapped in its owntry catch
.Solution
Add
}).catch(e => console.error(e))
at the end ofdynamicComponent#loadComponent()
.Your Environment
The text was updated successfully, but these errors were encountered: