components in -- lazy.module.ts
const routes: Routes = [
{ path: 'memberdetails', component: MemberDetailsComponent },
{ path: 'leaves', component: LeavemanagementComponent },
{ path: 'attendance', component: AttendanceComponent }
];
app-routing.module.ts
const routes: Routes = [
{ path: 'lazy', loadChildren: './lazy.module#LazyModule'},
];
It's working locally, but after hosting it when I click on any of these above links I am getting this error...
vendor.05d559e….bundle.js:1 ERROR Error: Uncaught (in promise): Error:
Loading chunk 0 failed.
Error: Loading chunk 0 failed.
at HTMLScriptElement.r (inline.9786b27….bundle.js:1)
at HTMLScriptElement.L (polyfills.1a7da64….bundle.js:1)
at e.invokeTask (polyfills.1a7da64….bundle.js:1)
at Object.onInvokeTask (vendor.05d559e….bundle.js:1)
at e.invokeTask (polyfills.1a7da64….bundle.js:1)
at r.runTask (polyfills.1a7da64….bundle.js:1)
at t.invokeTask [as invoke] (polyfills.1a7da64….bundle.js:1)
at h (polyfills.1a7da64….bundle.js:1)
at HTMLScriptElement.d (polyfills.1a7da64….bundle.js:1)
at HTMLScriptElement.r (inline.9786b27….bundle.js:1)
at HTMLScriptElement.L (polyfills.1a7da64….bundle.js:1)
at e.invokeTask (polyfills.1a7da64….bundle.js:1)
at Object.onInvokeTask (vendor.05d559e….bundle.js:1)
at e.invokeTask (polyfills.1a7da64….bundle.js:1)
at r.runTask (polyfills.1a7da64….bundle.js:1)
at t.invokeTask [as invoke] (polyfills.1a7da64….bundle.js:1)
at h (polyfills.1a7da64….bundle.js:1)
at HTMLScriptElement.d (polyfills.1a7da64….bundle.js:1)
at u (polyfills.1a7da64….bundle.js:1)
at u (polyfills.1a7da64….bundle.js:1)
at polyfills.1a7da64….bundle.js:1
at e.invokeTask (polyfills.1a7da64….bundle.js:1)
at Object.onInvokeTask (vendor.05d559e….bundle.js:1)
at e.invokeTask (polyfills.1a7da64….bundle.js:1)
at r.runTask (polyfills.1a7da64….bundle.js:1)
at o (polyfills.1a7da64….bundle.js:1)
at t.invokeTask [as invoke] (polyfills.1a7da64….bundle.js:1)
at h (polyfills.1a7da64….bundle.js:1)
Folder Structure:
If you are encountering this error as a user of an application, the simplest way to resolve it is to clear your browser cache (and also restart it for good measure) and try again. If the error was because your browser had cached older files, this should fix the issue.
We can use global error handling and force the app to reload if chunks failed. For this, we need to create a GlobalErrorHandler class that implements an ErrorHandler class. All it does is just check the error message if it has a Loading chunk [XX] failed, and forces the app to reload and load the new fresh chunks.
Chunk errors in Minecraft games are the corrupted visual blocks mismatching with the existing world.
A "ChunkLoadError" generally means that a checksum failed for a javascript file. These errors occur when the browser requests a JS code chunk, and receives a response whose checksum does not match the expected “integrity=…” attribute associated with the <script> tag that refers to it.
Clean Your Cache or use CTRL + Shift + R combo key and try again!
In my case The Ad Blocker Extension was creating this issue. Once i disabled it. The problem was solved
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With