本文介绍了TypeScript编译中缺少模块构建失败的ts.请通过“文件"或“包含"属性确保它位于您的tsconfig中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将应用程序从4号角升级到6号角.出现以下错误.我已经在tsConfig中添加了包含文件.我在执行ng测试时遇到错误.我想知道为什么它包含在tsConfig中时抱怨@wtw文件夹下的文件

I have upgraded my application from angular 4 to angular 6. I am getting the following error. I have already added the include files in the tsConfig. I am getting the error while running ng test. I wonder why it is complaining of a file under @wtw folder when it is included in the tsConfig

"include": [
    "./src/**/*",
    "./node_modules/@wtw/**/*",
     "./node_modules/@types/**/*"
  ]

错误消息

ERROR in ./node_modules/@wtw/platform/services/index.ts
Module build failed (from ../node_modules/@ngtools/webpack/src/index.js):
Error: C:\vstsprojects\testproject\testproject.ClientSide\node_modules\@wtw\platform\services\index.ts is missing from the TypeScript compilation. Please
make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an
issue in the library repository to alert its author and ask them to package the library using the Angular Package Format .
    at AngularCompilerPlugin.getCompiledFile (C:\vstsprojects\testproject\testproject.ClientSide\node_modules\@ngtools\webpack\src\packages\ngtools\webpac
k\src\angular_compiler_plugin.ts:988:15)
    at plugin.done.then (C:\vstsprojects\testproject\testproject.ClientSide\node_modules\@ngtools\webpack\src\packages\ngtools\webpack\src\loader.ts:49:29
)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 @ ./src/app/effects/risk-portfolio/risk-portfolio.effect.spec.ts 5:17-50
 @ ./src sync \.spec\.ts$
 @ ./src/test.ts

tsConfig

{
  "compileOnSave": false,

  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types",
      "type-definition"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },

  "include": [
    "./src/**/*",
    "./node_modules/@wtw/**/*",
     "./node_modules/@types/**/*"
  ]
}

推荐答案

我在您的app.routing.ts文件中遇到了相同的错误,请检查惰性模块的路由路径检查您的组件名称,并精确地更正路径中的小写或大写字母.

i got same error,in your app.routing.ts file , check routing path of lazy modulescheck your component name and correct the lowercase or uppercase in the path, exacactly.

这篇关于TypeScript编译中缺少模块构建失败的ts.请通过“文件"或“包含"属性确保它位于您的tsconfig中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 18:23