Next.js: Import of dynamic component with ssr: false that fails should log an error somehow

Created on 3 Sep 2017  路  5Comments  路  Source: vercel/next.js

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior



When I'm using some dynamic component with SSR: false that is crashing I expect it to see the error somehow.

Current Behavior



袗pp is just stuck in "loading..." page state: no page error, no console output, no term output.

Steps to Reproduce (for bugs)


// pages/index.js
import dynamic from 'next/dynamic'
const TestLoader = dynamic(import('../components/Test'), { ssr: false})
export default () => <TestLoader />
// components/Test.js
throw new Error('test')
export default () => <div>hello</div>

Context



Some 3rd-party libs are validating the initial options by throwing an error (e.g. Auth0); it makes nearly impossible to debug them

Your Environment


| Tech | Version |
|---------|---------|
| next | 3.2.1 |
| node | 8.4.0 |
| OS | Mac 10.12 |
| browser | Chrome |

bug

Most helpful comment

This really could post some error notification on bad loading.

Same behaviour with mapbox-gl. Mapbox-GL can't by minified with Uglyfier and must be skiped with webpack noParse. But find this problem takes some time, because in development env it work, in production doesn't. And no error in console :/

All 5 comments

This really could post some error notification on bad loading.

Same behaviour with mapbox-gl. Mapbox-GL can't by minified with Uglyfier and must be skiped with webpack noParse. But find this problem takes some time, because in development env it work, in production doesn't. And no error in console :/

Is there a workaround to at least showing the error that is causing a problem? I'm not using mapbox-gl, but I do have non-ssr dynamic imports that are stuck at loading. They load fine in development, but in production they just hang at loading... and nothing ever gets logged.

My issue is caused by trying to dynamically load a component that imports CSS modules. Moving the CSS module to the Page component that was loading the child component resolved my issue, but seeing some kind of error message would have obviously made this much easier.

Looks like this one should be closed too, as long as fix is there.
Sorry everyone for disappearing, my bad.

Was this page helpful?
0 / 5 - 0 ratings