简体   繁体   English

angular4-carousel无法与angular 5一起使用

[英]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. 我正在尝试在我的angular 5项目(angular4-carousel)中使用一个滑块,但是正如我提到的那样,它会引发抛出错误,我尝试使用ngx-carousel,但是那也无法正常工作。

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. ./node_modules/angular4-carousel/index.ts中的错误模块构建失败:错误:D:\\ Workspace \\ ntwine \\ node_modules \\ angular4-carousel \\ index.ts不属于编译输出的一部分。 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? 在plugin.done处的AngularCompilerPlugin.getCompiledFile(D:\\ Workspace \\ ntwine \\ node_modules \\ @ngtools \\ webpack \\ src \\ angular_compiler_plugin.js:649:23)处,然后(D:\\ Workspace \\ ntwine \\ node_modules \\ @ngtools \\ webpack \\ src \\ loader.js:467:39)在process._tickCallback(内部/进程/next_tick.js:103:7)@ ./src/app/app.module.ts 12:0-51 @ ./src/main .ts @多webpack-dev-server / client? http://0.0.0.0:0 ./src/main.ts 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. 通过将以下行添加到src目录下的tsconfig.app.json文件中,我能够解决此问题并使其正常工作。

, //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. 这是我在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"
  ]
}

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

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