Upgrading Angular 8 to Angular 9 Error: .ts is missing from the TypeScript compilation
Upgrading Angular 8 to Angular 9 Error: .ts is missing from the TypeScript compilation
我最近将 Angular 8 应用程序升级到 Angular 9,使用以下命令:
ng update @angular/core@8 @angular/cli@8
ng update @angular/core @angular/cli
唯一需要手动更改的包是 ngx-store
到 ngx-store-9
,我使用以下命令完成了更改:
npm uninstall ngx-store
npm install ngx-store-9
然后我继续将 ngx-store
的所有导入语句更改为 ngx-store-9
。
我现在在构建我的应用程序时收到以下错误:
ERROR in ./src/app/models/companySearchCriteria.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\src\app\models\companySearchCriteria.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:933:23)
at D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\node_modules@ngtools\webpack\src\loader.js:41:31
at processTicksAndRejections (internal/process/task_queues.js:93:5)
下面是我的 tsconfig.app.json
文件:
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
我不太清楚为什么会这样。任何帮助将不胜感激。
在我的例子中,由于某种原因,导入语句中的文件名被大写化了。
例如,假设我有以下 .ts 文件:companySearchModel.ts
export class CompanySearchModel {
//some properties
}
另一个文件中使用 companySearchModel
的导入语句如下所示:
import { CompanySearchModel } from './models/CompanySearchModel.ts'
当它应该看起来像这样时:
import { CompanySearchModel } from './models/companySearchModel.ts'
不确定为什么会这样,但在导入语句中更改文件名以反映文件的真实名称(小写)后,它起作用了。
在我的例子中,我只关闭编译器并重新启动。
问题已解决。
希望有用
我最近将 Angular 8 应用程序升级到 Angular 9,使用以下命令:
ng update @angular/core@8 @angular/cli@8
ng update @angular/core @angular/cli
唯一需要手动更改的包是 ngx-store
到 ngx-store-9
,我使用以下命令完成了更改:
npm uninstall ngx-store
npm install ngx-store-9
然后我继续将 ngx-store
的所有导入语句更改为 ngx-store-9
。
我现在在构建我的应用程序时收到以下错误:
ERROR in ./src/app/models/companySearchCriteria.ts Module build failed (from ./node_modules/@ngtools/webpack/src/index.js): Error: D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\src\app\models\companySearchCriteria.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. at AngularCompilerPlugin.getCompiledFile (D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:933:23) at D:_lieben\DevOps\Gtrack Web v3\GTrack.UI\Gtrack\node_modules@ngtools\webpack\src\loader.js:41:31 at processTicksAndRejections (internal/process/task_queues.js:93:5)
下面是我的 tsconfig.app.json
文件:
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
我不太清楚为什么会这样。任何帮助将不胜感激。
在我的例子中,由于某种原因,导入语句中的文件名被大写化了。
例如,假设我有以下 .ts 文件:companySearchModel.ts
export class CompanySearchModel {
//some properties
}
另一个文件中使用 companySearchModel
的导入语句如下所示:
import { CompanySearchModel } from './models/CompanySearchModel.ts'
当它应该看起来像这样时:
import { CompanySearchModel } from './models/companySearchModel.ts'
不确定为什么会这样,但在导入语句中更改文件名以反映文件的真实名称(小写)后,它起作用了。
在我的例子中,我只关闭编译器并重新启动。
问题已解决。
希望有用