简体   繁体   English

您可能需要适当的加载程序来处理此文件类型。 Angular 5应用程序中的错误

[英]You may need an appropriate loader to handle this file type. error in Angular 5 app

I just started learning angular 5. Now I got the below error 我刚刚开始学习角度5。现在出现以下错误

Failed to compile. 编译失败。

 ./src/app/route/app.routing.ts Module parse failed: Unexpected token (4:28) You may need an appropriate loader to handle this file type. | Object.defineProperty(exports, "__esModule", { value: true }); | var appRoutes = [ | { path: '', component: } | ]; | @ ./src/app/app.module.ts 11:20-50 @ ./src/main.ts @ multi (webpack)-dev-server/client?http://0.0.0.0:0 ./src/main.ts 

And my app.routing.ts file 还有我的app.routing.ts文件

import { RouterModule, Routes } from '@angular/router';

import { ProductListComponent } from '../product-list/product-list.component';

const appRoutes : Routes = [

    {path: '', component: ProductListComponent, pathMatch:'full'},
    {path:'product-list', component: ProductListComponent, pathMatch: 'full'},
    {path: '**', redirectTo: ''}

];

export const routing = RouterModule.forRoot(appRoutes);

I couldn't find out what does the error really mean.Please help 我无法确定错误的真正含义。请帮助

try redirectTo 尝试redirectTo

const appRoutes : Routes = [

    {path: '', redirectTo: '/product-list', pathMatch: 'full'},
    {path:'product-list', component: ProductListComponent, pathMatch: 'full'},
    {path: '**', redirectTo: ''}

];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您可能需要适当的加载器来处理此文件类型-带有React的Angular 4 - You may need an appropriate loader to handle this file type - Angular 4 with React Angular 2 - Karma 错误 - 模块解析失败“您可能需要合适的加载程序来处理此文件类型” - Angular 2 - Karma Error - Module Parse Failed 'You may need an appropriate loader to handle this file type' 您可能需要适当的加载程序来处理此文件-.net core和Angular - You may need an appropriate loader to handle this file - .net core & Angular Angular 12 升级错误:您可能需要合适的加载器来处理此文件类型,目前没有配置加载器来处理此文件 - Angular 12 upgrade error: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file 使用 Angular 和 LitElement 时,您可能需要适当的加载程序来处理此文件类型 - You may need an appropriate loader to handle this file type when using Angular and LitElement 未捕获的错误:模块解析失败:您可能需要合适的加载程序来处理此文件类型 - Uncaught Error: Module parse failed:You may need an appropriate loader to handle this file type Angular您可能需要适当的加载程序错误 - Angular You may need an appropriate loader error Angular 12 升级问题:您可能需要适当的加载程序来处理此文件类型,目前没有配置加载程序来处理此文件 - Angular 12 upgrade issue : You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file 未捕获(承诺):错误:模块解析失败:意外令牌(91:0)您可能需要适当的加载程序来处理此文件类型 - Uncaught (in promise): Error: Module parse failed: Unexpected token (91:0) You may need an appropriate loader to handle this file type 模块解析失败:您可能需要适当的加载程序来处理此文件类型 - Module parse failed:You may need an appropriate loader to handle this file type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM