0

我想用 jasmine 测试应用程序,编译完成后我收到以下消息:

Chrome 67.0.3396 (Windows 10 0.0.0) ERROR
  {
    "message": "Uncaught ReferenceError: exports is not defined\nat app/app-routing.module.js:2:23\n\nReferenceError: exports is not defined\n    at app/app-routing.module.js:2:23",
    "str": "Uncaught ReferenceError: exports is not defined\nat app/app-routing.module.js:2:23\n\nReferenceError: exports is not defined\n    at app/app-routing.module.js:2:23"
  }

我试图export = 0在文件顶部添加,但我得到另一个错误: An export assignment cannot be used in a module with other exported elements.

我也尝试将 jasmine 从 devDependencies 移至依赖项,但没有成功。

也尝试更改compilerOptions.module为无,也没有工作...... 在浏览器中(业力)业力调试器错误

应用程序路由.module.ts

import { NgModule } from "@angular/core";
import { Routes } from "@angular/router";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { LoggedInLazyLoadGuard } from "./logged-in-lazy-load.guard";

const routes: Routes = [
    { path: "", redirectTo: "/home", pathMatch: "full" },
    { path: "login", loadChildren: "./login/login.module#LoginModule" },
    { path: "home", loadChildren: "./home/home.module#HomeModule", canLoad: [LoggedInLazyLoadGuard] }
];

@NgModule({
    imports: [NativeScriptRouterModule.forRoot(routes)],
    exports: [NativeScriptRouterModule]
})
export class AppRoutingModule { }

tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true,

        "lib": [
            "es6",
            "dom",
            "es2015.iterable"
        ],
        "baseUrl": ".",
        "paths": {
            "~/*": [
                "app/*"
            ],
            "*": [
                "./node_modules/tns-core-modules/*",
                "./node_modules/*"
            ]
        }
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

版本

tns: 4.1.0
npm: 6.1.0
node: 8.11.2
4

0 回答 0