question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@loadable/component failed to asynchronously load component

See original GitHub issue

🐛 Bug Report

@loadable/component raise the following exception when loading chunk.

The chunkName argument appears buggy as [undefined] while the url to the resource js is accessible.

loadable-components: failed to asynchronously load component [object Object]
logger: console
arguments: ["loadable-components: failed to asynchronously load component",{"chunkName":"[undefined]","error":"Loading chunk 31 failed.\n(error: https://static.hipacloud.com/web/0.2.610-8decb5a5/_next/static/chunks/XXXXHIDDENXXXXXX.js)","fileName":"[undefined]"}]

To Reproduce

GIVEN a user stays on page A of package version 0.0.1 AND the new package version 0.0.2 is deployed AND the old package version 0.0.1 still has all static resources accessible

WHEN he triggers a component to be mounted, which was imported via loadable() AND the chunk for this component is new in package version 0.0.2

THEN the page displays error info due to a ChunkLoadError is raised AND the sentry log points out the exception comes from loadable

Expected behavior

No matter when the dynamically component load happens, it should load a chunk correctly if its url is accessible.

Link to repl or repo (highly encouraged)

Using nextjs 10.0.3 with @loadable/component.

Run npx envinfo --system --binaries --npmPackages @loadable/component,@loadable/server,@loadable/webpack-plugin,@loadable/babel-plugin --markdown --clipboard

Paste the results here:

## System:
 - OS: macOS 10.15.6
 - CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
 - Memory: 1.91 GB / 16.00 GB
 - Shell: 3.2.57 - /bin/bash
## Binaries:
 - Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
 - Yarn: 1.21.1 - /usr/local/bin/yarn
 - npm: 6.14.9 - ~/Works/hipa/repositories/hipa-web/node_modules/.bin/npm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

8reactions
wushaobocommented, Jan 12, 2021

For the past 12 days, crossing several releases, ChunkLoadError does not happen so far.

0reactions
don4commented, Jun 10, 2022

My chunk is not getting loaded, what is the reason, while other chunk got loaded on same component on same page, can you please help me on that ? all are loaded success fully except AppPortals - some information regarding this - we have used React.memo inside the AppPortals - is it happening because of this ?

My code as follows const ToastContainer = loadable(() => import(“@bbb-app/core-ui/toast-message/ToastMessage”) ); const AppPortals = loadable(() => import(“@bbb-app/app-portals/AppPortals”)); —> this is not getting loaded. const Tealium = loadable(() => import(“@bbb-app/tealium/containers/Tealium”)); const GlobalNotification = loadable(() => import(“@bbb-app/global-notification/container”) ); const StickyButtons = loadable(() => import(“…/common/containers/sticky-buttons/StickyButtons”) );

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

loadable-components: failed to asynchronously load component
I expected that when I npm install module A on module B to be able to import and render my components but instead...
Read more >
Loadable Components
LoadableComponent.load. Force the loading of a component synchronously, returns a Promise. Arguments, Description. args, Props ...
Read more >
Loadable-components NPM - npm.io
I tried several solutions, react-async-components, react-loadable and for ... You can configure the component rendered when an error occurs during loading, ...
Read more >
react-loadable | Best of JS
Component -based splitting. A common piece of advice you will see is to break your app into separate routes and load each one...
Read more >
React Loadable:
Let's make it loaded asynchronously ... Avoiding Flash Of Loading Component ... export default function MyLoadingComponent({ error, pastDelay }) {.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found