index.ts不是编译输出的一部分

Mee*_*ana 7 compiler-errors compilation angular

我正在尝试编译我的Angular应用程序并收到错误.似乎是编译器没有识别index.ts文件.我不知道为什么.

以下是错误:

ERROR in ./node_modules/datatable/index.ts
Module build failed: Error: node_modules\datatable\index.ts is not part of the compilation output. Please check the other error messages for details.
    at AngularCompilerPlugin.getCompiledFile (node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
    at plugin.done.then (node_modules\@ngtools\webpack\src\loader.js:467:39)
    at process._tickCallback (internal/process/next_tick.js:103:7)
 @ ./src/main/ui/app/app.module.ts 13:0-59
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./node_modules/typeahead/index.ts
Module build failed: Error: node_modules\typeahead\index.ts is not part of the compilation output. Please check the other error messages for details.
    at AngularCompilerPlugin.getCompiledFile (\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
    at plugin.done.then (node_modules\@ngtools\webpack\src\loader.js:467:39)
    at process._tickCallback (internal/process/next_tick.js:103:7)
 @ ./src/main/ui/app/app.module.ts 12:0-59
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
Run Code Online (Sandbox Code Playgroud)

有没有人对如何解决这个问题有任何建议?谢谢.

小智 5

我有一个与angular-bootstrap-md\index.ts类似的问题

我该如何解决它:

只需将index.ts文件放入tsconfig.jsons include块,如下所示:

{
  "compileOnSave": false,
  "compilerOptions": {
  "outDir": "./dist/out-tsc",
  "sourceMap": true,
  "declaration": false,
  "moduleResolution": "node",
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "target": "es5",
  "typeRoots": [
    "node_modules/@types"
  ],
  "lib": [
    "es2017",
    "dom"
  ]  
},
"include": [
  "src/**/*",
  "node_modules/angular-bootstrap-md/index.ts"
  ]
 }
Run Code Online (Sandbox Code Playgroud)

资料来源:https://github.com/angular/angular/issues/20091


Mee*_*ana 1

这是一个简单的修复 - 运行以下命令: npm install --save @ngtools/webpack@1.2.4