简体   繁体   中英

angular4-carousel not working with angular 5

I'm trying to use a slider in my angular 5 project (angular4-carousel) but its throwing error as I mentioned, I have tried using ngx-carousel but that one is also not working.

ERROR in ./node_modules/angular4-carousel/index.ts Module build failed: Error: D:\\Workspace\\ntwine\\node_modules\\angular4-carousel\\index.ts is not part of the compilation output. Please check the other error messages for details. at AngularCompilerPlugin.getCompiledFile (D:\\Workspace\\ntwine\\node_modules\\@ngtools\\webpack\\src\\angular_compiler_plugin.js:649:23) at 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

Why I got this error?

I was able to solve this and get this working by adding the following line to my tsconfig.app.json file under the src directory.

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

This is my edited tsconfig.app.json file located under the src directory.

 {
  "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"
  ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM