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

Import of dynamic component with ssr: false that fails should log an error somehow #2898

Closed
1 task done
Jabher opened this issue Sep 3, 2017 · 5 comments
Closed
1 task done

Comments

@Jabher
Copy link

Jabher commented Sep 3, 2017

  • 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
@radeno
Copy link
Contributor

radeno commented Sep 12, 2017

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 :/

@ckeeney
Copy link

ckeeney commented Apr 28, 2018

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.

@ckeeney
Copy link

ckeeney commented Apr 28, 2018

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.

@vjpr
Copy link

vjpr commented May 7, 2018

Here is the cause explained: #4287

PR is here: #3897

@Jabher
Copy link
Author

Jabher commented May 7, 2018

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

@Jabher Jabher closed this as completed May 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants