I am developing an angular application where I have the following structure:
-App
-----findcourse
-----login
-----mainlayout
-----navbar
-----register
I have defined my routing in app.module.ts and calling it in the html file by using router-outlet. However, when I try to run my code it's throwing an error:
ERROR in ./src/app/app.module.ts 13:15
Module parse failed: Unexpected token (13:15)
File was processed with these loaders:
* ./node_modules/@ngtools/webpack/src/index.js
You may need an additional loader to handle the result of these loaders.
| import * as i0 from "@angular/core";
| import * as i1 from "@angular/router";
> const appRoutes;
| [
| { path: '/', component: MainlayoutComponent },
Here's my index.js file:
"use strict";
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NgToolsLoader = exports.default = void 0;
__exportStar(require("./angular_compiler_plugin"), exports);
__exportStar(require("./interfaces"), exports);
var loader_1 = require("./loader");
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return loader_1.ngcLoader; } });
exports.NgToolsLoader = __filename;
question from:
https://stackoverflow.com/questions/65860712/angular-module-parse-failed-unexpected-token-1315 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…