Unclear Dynamic Import Error Messages
See original GitHub issueForgive me for dropping the GitHub issue template, but this is a little more philosophical than technical!
I think the dynamic import error messages could be a little clearer in meaning.
https://github.com/zeit/next.js/blob/master/lib/dynamic.js#L21
This error is thrown when you have a { modules: ..., render: ... }
object as the first argument, and a { loading: ...}
object as the second argument. To me, the phrasing of the error indicates that this is what I should be doing. I think rewording it to say something like “Cannot include options when the first argument is an object that contains modules
and render
fields” is much clearer in describing what the programmer has done wrong.
https://github.com/zeit/next.js/blob/master/lib/dynamic.js#L16
This could also be rewritten to read “The first argument should contain both module
and render
fields” or something similar.
I’m happy to submit a patch on this, but wanted to discuss new wording a little bit before doing it 😄
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I’m getting this error message, how do I fix this?
Here’s my code:
I’m using typescript.
I had the same issue as @johhansantana and @rohmanhm
I’ve solved it with the “4. With Multiple Modules At Once” example by adding the
ssr: false
inside the root object:https://github.com/zeit/next.js#4-with-multiple-modules-at-once