所以我遇到了MimeType问题。我的.js文件正在返回我的index.html文件,因为找不到它们。我意识到.js文件的网址正试图从 域/路由/路由2 / bundledjsfile.js 但是当我访问它时,就像我说的那样,它返回HTML而不是JS。但是,在地址栏中更改路线后,我注意到d domain / route / bundledjsfile.js返回缩小后的实际js。
preProc
这仅在我有一条子路径试图渲染组件时发生
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
06:12:19.128 polyfills-es2015.3fd94ed6a324eee92aec.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
06:12:19.128 main-es2015.0b1d748ffcf78a2a0b26.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
我不确定如何解决此问题,因为我的服务器阻止位置设置如下:
const routes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard] },
{ path: 'dashboard/guilds', component: GuildsComponent, canActivate: [AuthGuard] }];
/ intellectual是要提供的Angular应用程序。 仅当我访问应用程序的主要路径时,例如,NGINX提供的基本URL是/ intellectual,Angular路径是/ guild,/ dashboard等,并且由于JS / CSS文件返回而可以正常工作,因此也会发生此问题正确地。但是,如果我尝试访问子路线,例如/ intellectual / guild / my-guild或/ intellectual / dashboard / my-dashboard,则会引发错误。因此,我不知道该怎么办才能解决此问题。我知道这是路径问题。