angular4-carousel不使用角度5

时间:2017-12-19 07:50:16

标签: javascript html angular5

我正在尝试在我的角度5项目(angular4-carousel)中使用滑块,但是我提到它的投掷错误,我尝试过使用ngx-carousel但是那个也没有用。

   ./node_modules/angular4-carousel/index.ts中的错误       模块构建失败:错误:D:\ Workspace \ ntwine \ node_modules \ angular4-carousel \ index.ts不是   编译输出的一部分。请检查其他错误消息   详情。           在AngularCompilerPlugin.getCompiledFile(D:\ Workspace \ ntwine \ node_modules \ @ngtools \ webpack \ src \ angular_compiler_plugin.js:649:23)           在plugin.done.then(D:\ Workspace \ ntwine \ node_modules \ @ngtools \ webpack \ src \ loader.js:467:39)           at process._tickCallback(internal / process / next_tick.js:103:7)        @ ./src/app/app.module.ts 12:0-51        @ ./src/main.ts        @ multi webpack-dev-server / client?http://0.0.0.0:0 ./src/main.ts

为什么我收到此错误?

1 个答案:

答案 0 :(得分:4)

我能够通过在 src 目录下的 tsconfig.app.json 文件中添加以下行来解决这个问题。

, //I added this section to fix the compile error
  "include": [
    "node_modules/angular4-carousel/index.ts"
  ]

这是位于src目录下的已编辑 tsconfig.app.json文件。

 {
  "compilerOptions": {
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2016",
      "dom"
    ],
    "outDir": "../out-tsc/app",
    "target": "es5",
    "module": "es2015",
    "baseUrl": "",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
, //I added this section to fix the compile error, must pass the adject path of index.ts file
  "include": [
    "../node_modules/angular4-carousel/index.ts"
  ]
}