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.

ChunkLoadError on Android

See original GitHub issue

Environment

Android 10. React Natvie 64.2

Description

So my build is finished successfully, the main bundle is generated but somehow the chunk is not getting copied to the APK resulting in ChunkLoadError.

Screen Shot 2021-07-15 at 8 07 25 PM

When I run manually with this command, the chuck is in the correct assets folder. npx react-native webpack-bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle

Screen Shot 2021-07-15 at 7 54 03 PM

So I suppose the problem is that the bundle is not getting copied by react-native Gradle because the APK doesn’t have any of the chunks that they are supposed to have.

Screen Shot 2021-07-15 at 8 05 28 PM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
zamotanycommented, Jan 10, 2022

@DanijelBojcic localChunks matches only chunk name (or id if can cannot be obtained), so /\.chunk\.(js)?bundle$/ won’t match anything. If you want to match everything you should provide /.*/ instead. If you want only specific chunks I suggest to:

  1. Use /* webpackChunkName: "myChunk" */ in import()
  2. Set localChunks: ['myChunk'] or localChunks: [/myChunk/]
1reaction
zamotanycommented, Jul 16, 2021

Can you prepare a repro project? Something is wrong with the way your project is being built, because it should never load chunk with such URI - noop://.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack chunks are unable to load on Android. Web and iOS ...
Webpack chunks are unable to load on Android. Web and iOS are fine ( ChunkLoadError: Loading chunk pages-home-home-module failed.).
Read more >
ChunkLoadError: Loading chunk failed - Capacitor - Ionic Forum
My working project is working fine on the web, and on my 1 year old Android phone, but I get a “ChunkLoadError: Loading...
Read more >
React Static Web Apps Manage ChunkLoadErrors on ...
The issue with this code is that there is no error handling, and promises can fail to download the chunk resulting on the...
Read more >
How to Solve the Chunk Load Error in JavaScript - Rollbar
Whenever there's an error observed in dynamically fetching helper JavaScript files known as Chunks, a ChunkLoad Error is thrown.
Read more >
Why do I get a ChunkLoadError only on iOS? : r/reactjs - Reddit
... try to dynamically import them, resulting in a ChunkLoadError ("loading chunk 23 failed. ... It always succeeds on desktop and Android.
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