延迟加载问题:加载块0失败

问题描述 投票:5回答:3

-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'},
 ];

它在本地运行,但是当我单击以上任何链接时将其托管后,就会出现此[[错误 ...

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)
文件夹结构:

enter image description here

angular lazy-loading
3个回答
4
投票
清理缓存或使用CTRL + Shift + R组合键,然后重试!

2
投票
CTRL + Shift + R硬重载在我的特殊情况下有所帮助,因为我的问题是我进行了设计更改并需要硬重载。不确定是否可以在所有情况下解决此错误。

0
投票
就我而言

Ad Blocker扩展程序正在创建此问题。一旦我禁用它。问题已解决

© www.soinside.com 2019 - 2024. All rights reserved.