【问题标题】:angular4-carousel not working with angular 5angular4-carousel 不适用于 angular 5
【发布时间】:2018-06-01 14:35:55
【问题描述】:

我正在尝试在我的 angular 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) 在 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

为什么会出现这个错误?

【问题讨论】:

  • 嗯,谢谢你的阅读,但我是新来的,我被困得很厉害,所以我刚刚发布了这里的想法可能是有人已经使用它了..
  • ngx-carousel 正在使用 angular5,我错过了一个导入文件,这就是它造成问题的原因,直到不确定 angular4-carousel。

标签: javascript html angular5


【解决方案1】:

我能够通过将以下行添加到 src 目录下的 tsconfig.app.json 文件来解决此问题并使其正常工作。

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

这是我的 edited tsconfig.app.json 文件,位于 src 目录下。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    • 2018-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多