-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
What is the best way to prevent failure to load component or catch properly? #961
Comments
@theKashey Do you know how to handle it? |
You need to handle errors. Just put ErrorBoundary above loadable - https://loadable-components.com/docs/error-boundaries/ There is no other (supported) way. The problematic part here is that loadable don't "own" errors - they are originated from webpack not being able load what it was expected to load, but this is webpack internal logic nobody else is aware of. There could be an improvement related to easier detection of "loading" errors versus "runtime" errors, right now this information (STATUS_REJECTED) is not exposed. |
What do you think about this approach? @theKashey
|
What you want to do should be now possible via creating a custom wrapper around loadable, you are totally right here. But you cannot intervene into Please play with the new babel configuration introduced at #966 to wrap internal logic with what you need. |
Do you mean I should not pass import function and load inside of the wrapper? Unfortunately, I cannot use babel plugin |
If you are not using babel - then no worries at all. Your code would work. Just some pieces of loadable, like support for SSR, will not. |
@theKashey Thanks for the answers! I will close this issue. |
💬 Questions and Help
"webpack": "^5.75.0",
"@loadable/component": "^5.15.2",
I do not use ssr.
I am getting a lot of loadable-components: failed to asynchronously load component in my sentry. I am guessing it is because of the filename change on deploy, but I like to catch or prevent it so I can clean up the sentry. What is your recommendation?
Here is full error logs
Its also seem to get error on preload() with
undefined is not an object (evaluating 'e.__esModule')
.The text was updated successfully, but these errors were encountered: