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

标签 angular compiler-errors compilation

我正在尝试编译我的 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

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

最佳答案

angular-bootstrap-md\index.ts

我遇到了类似的问题

how I could fix it:

Just put the index.ts file to the tsconfig.jsons include block , see below:

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

Source: https://github.com/angular/angular/issues/20091

关于angular - index.ts 不是编译输出的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47184714/

相关文章:

typescript - NG2 : angular2-webpack-starter - what is the purpose of HMR?

angular - 使用 DirectiveResolver 更改 @Component 元数据

c++ - Makefile:对 'std::...' 的 undefined reference

java - Ubuntu中使用javac编译时出错

angular - 一个项目,多个客户。 Angular 2

angular - 无法加载http ://localhost:9999/auth-service/oauth/token: Response for preflight has invalid HTTP status code 401

haskell - 如何更改 GHC 编译器错误消息的打印方式?

android - Android “The specified child already has a parent.” fragment onCreateView()吗?

emacs - 如何在Emacs中设置编译的默认目录?

c - 通过添加当前目录来编辑 PATH。不通过键入不带 "./"的文件名来编译 *.c 文件