You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 5编译报错:index.ts未配置在tsconfig的files/include中

Fix "Missing from TypeScript compilation" Error for Custom Nebular Auth Components

Alright, let's tackle this error you're facing after copying the Nebular auth UI component folder. The root issue here is that your TypeScript compiler doesn't know about the new index.ts file in your custom auth component directory—your current tsconfig.json doesn't specify which files to include in the compilation process.

Here's how to fix it:

Step 1: Update Your tsconfig.json

Add an include property to your configuration to explicitly tell TypeScript to compile your custom auth components, along with all your existing app code. Replace your current config with this:

{
  "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" ],
    "plugins": [ { "name": "tslint-language-service"} ]
  },
  "include": [
    "src/**/*.ts",
    "src/app/@theme/components/auth/**/*.ts"
  ]
}

What This Does:

  • "src/**/*.ts": This catches all .ts files in your src directory and its subfolders—ensuring your entire app code gets compiled.
  • "src/app/@theme/components/auth/**/*.ts": Explicitly targets your custom auth component directory, making sure the index.ts (and any other .ts files there) are included in the TypeScript build.

Step 2: Check for a tsconfig.app.json (If You're Using Angular)

Many Angular projects use a separate tsconfig.app.json file for app-specific compilation rules. If this exists in your project, you'll need to add the same include rules there too:

{
  // ... existing compilerOptions
  "include": [
    "src/**/*.ts",
    "src/app/@theme/components/auth/**/*.ts"
  ]
}

Quick Sanity Check

Double-check that the path src/app/@theme/components/auth/index.ts actually exists—typos in file paths are a common culprit here!

Once you update your config, restart your development server (if it's running) to apply the changes. The TypeScript compiler should now recognize your custom auth component files and the error should disappear.

内容的提问来源于stack exchange,提问作者Umair Malik

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:03:46