경고 .ts 파일을 삭제하는 방법은 TypeScript 컴파일의 일부이지만 사용되지 않습니다.
angular로 했습니다.9.0.0-next.4
루팅을 사용하지 않고 있는데 업데이트 후 갑자기 이 경고가 계속 표시됩니다.는 어떻게 합니까?
고의
src/war/angular/src/app/app-routing.module.ts
TypeScript 컴컴일scriptscript 。tsconfig' 'files' 합니다.
패키지.json
"dependencies": {
"@angular/animations": "^9.0.0-next.4",
"@angular/cdk": "^8.1.4",
"@angular/common": "^9.0.0-next.4",
"@angular/compiler": "^9.0.0-next.4",
"@angular/core": "^9.0.0-next.4",
"@angular/forms": "^9.0.0-next.4",
"@angular/material": "^8.1.4",
"@angular/platform-browser": "^9.0.0-next.4",
"@angular/platform-browser-dynamic": "^9.0.0-next.4",
"@angular/router": "^9.0.0-next.4",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"bootstrap": "^4.3.1",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ng-image-slider": "^2.0.1",
"panzoom": "^8.1.2",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"zone.js": "^0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.2",
"@angular/cli": "^8.3.2",
"@angular/compiler-cli": "^9.0.0-next.4",
"@angular/language-service": "^9.0.0-next.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "^5.15.0",
"typescript": "^3.5.3"
}
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
}
이 라인을 "이 포함)에서 제거할 필요가 있다는 것을 확인했습니다.에서 이 행을 삭제해야 합니다."src/**/*.ts"
부에서tsconfig.app.json
파일(기본값 및 폴리필트)에 입력 지점을 유지하십시오.에만 진입점을 보관합니다.
I could get it working by defining the 이 시스템을 작동시킬 수 있는files
property in 에 있어서의 재산.tsconfig.app.json
. . These files are relative to the 이 파일들은 에 상대적입니다.tsconfig.app.json
"files": [
"main.ts",
"polyfills.ts"
]
CLI 로컬 "global" "Angular 8" "Angular 9" "Angular.json" "Environment.*"ts "Environment."나는 뛰지 .ng update
을 다음과 할 수 수동으로tsconfig했습니다.tsconfig.json은 업데이트했습니다.「tsconfig.json」입니다.
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
그러면 경고가 사라집니다.
Visual Studio Professional 2019에서 Angular 9.1.x로 2020-05-27 업데이트
위의 작은 블록은 더 이상 필요하지 않습니다. 않으면 "Module not found"가 "Module not found"로 되어 있는 로부터 실제로 하는 모듈에 " found하는 합니다.ng test
빌드 및 실행은 문제없으며, ng 앱의 빌드 및 실행은 문제 없습니다.NG에서 9.1과 9.1 사이에 뭔가 변화가 있었던 것 같습니다.
현재 작업 중인 tsconfig.json은 다음과 같습니다.
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2020",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"skipLibCheck": true
}
}
비고:
Google Chrome과 Safari만을 대상으로 하고 있기 때문에 다른 브라우저를 대상으로 하고 싶다면 그에 따라 조정해야 할 수도 있습니다.
@angular-builders/custom-webpack을 사용하고 있습니까?
Angular 10 서서 angular angular angular angular angular angular angular angular angular angular angular angular angular 。「」의 변경includes
를를를를
그리고 https://github.com/angular/angular/pull/36211을 찾았습니다.
으로 이 단, 이 에러는 에러입니다.ngtypecheck.ts
파일(정확히 어떤 파일인지 모르겠어요!)
/home/circci/ng/aio/src/main.ngtypecheck.ts의 경고는 TypeScript 컴파일의 일부이지만 사용되지 않습니다.tsconfig의 'files' 또는 'include' 속성에는 진입점만 추가합니다.
내가 보기엔 이건 사실 내가 보기엔@angular-builders/custom-webpack
.
https://github.com/just-jeb/angular-builders/issues/781에서 문제가 발생한 지 얼마 되지 않았습니다.이 점을 지적해 주신 https://stackoverflow.com/a/62573294/16940에 감사드립니다.
v10.0.1로 업데이트하면 수정이 되었지만, 최신 정보는 위의 문제를 참조하십시오.
"@angular-builders/custom-webpack": "10.0.1" // as of today
이것은 명백하게 보일 수 있지만 추가되었지만 아직 참조되거나 다른 파일로 Import되지 않은 파일에 대해 이 경고가 표시됩니다.이 문제는 경고 대상 파일 중 하나를 편집하려고 하면 명백해지고 Ivy는 파일을 편집한 후 자동으로 다시 컴파일하지 않습니다.모듈을 종속 파일로 Import하여 사용하기 시작하면 경고가 사라집니다.
위의 답변이 일부 관련될 수 있지만, 이 게시물에서 설명한 내용이 경고의 근본 원인입니다.tsconfig.json 또는 tsconfig.app.json에는 include 또는 files 배열이 없습니다.프로젝트 내의 다른 파일을 실제로 참조하면 경고가 사라집니다.
오늘 Angular 9로 업데이트되어 경고를 받았습니다.제 솔루션은 경로에 "src"를 포함하지 않고 이 "파일" 어레이를 추가하는 것이었습니다.방금 추가:
"files": [
"main.ts",
"polyfills.ts"
],
전체 tsconfig.app.json 파일은 다음과 같습니다.
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"types": ["node"]
},
"files": [
"main.ts",
"polyfills.ts"
],
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
02-08-2020
Ionic 5+ Angular 9+ 앱.
주의: 를 참조해 주세요.include
★★★★★★ 。
tsconfig.app.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"exclude": [
"src/**/*.spec.ts"
]
}
zone-flags.ts도 추가하고 포함 항목도 모두 삭제합니다.
"files": [
"src/main.ts",
"src/polyfills.ts",
"src/zone-flags.ts"
]
tsconfig.app.json
"exclude": [
"src/**/*.spec.ts",
"src/test.ts",
"src/environments/environment.prod.ts"
]
이 단편은 문제를 해결합니다.
했다.Angular 10
으로, 를 할 때 .프로드 빌드를 할 때 메시지를 받았습니다.test.ts
★★★★★★★★★★★★★★★★★」enviornments.prod.ts
이 파일들은 기본적으로 제외되어 있다고 생각합니다만, 제외되어 있지 않고, 이상합니다.
이 파일들은 TypeScript 변환에 필요하지 않습니다..js
번들되어 브라우저로 전송되는 파일의 버전.test.ts
★★★★★★★★★★★★★★★★★」environments.prod.ts
앵귤러에, 「 」, 「 」에 할 수 있습니다.exclude
의 항을 참조해 주세요.tsconfig.app.json
TypeScript를 사용합니다.
"exclude": [
"src/**/*.spec.ts",
"src/test.ts",
"src/environments/environment.prod.ts"
]
위와 같이 추가되면 경고는 더 이상 표시되지 않습니다.
합니다.node_modules/.cli-ngcc
앵귤러 CLI 캐캐 cli 。
이전 해결책 제안서를 시험한 후, 그것은 나에게 효과가 있었다.
업데이트 할 수 있습니다.json
"@angular-devkit/build-angular": "~0.1000.3"
여기 모든 버전이 보이시나요?
angular/core에서 현재 버전과 함께 사용할 수 있는 버전을 선택하십시오.
Angular 10의 경우 버전 0.1000.3의 @syslog-devkit/build-build-module을 사용합니다.
Angular 10으로 업그레이드한 후에도 동일한 경고가 표시되었습니다..npm i
일부 Dev 종속성에 대한 버전 불일치가 보고되었습니다.후 ( 「」 「」 )npm i <package>@latest
10.nodejs는 12(버전 10)로 업데이트 됩니다.
제 경우 업데이트해야 할 패키지는 다음과 같습니다.
@angular-devkit/build-angular
codelyzer
저 같은 경우에는 경고에 의해 보고된 클래스가 실제로 사용되고 있었습니다.다만, Import시에 확장자 「.js」가 붙은 것이 문제였습니다.
따라서 이 행은 "WARNING in src\app\user.service.ts는 TypeScript 컴파일의 일부이지만 사용되지 않습니다."라는 오류를 발생시켰습니다.
import { UserService } from './user.service.js';
확장자 ".js"를 삭제하여 수정할 수 있습니다.
import { UserService } from './user.service';
은 몇 달 이 에 대해 , 우리 팀이 이런 을 겪고 있다는 되었다.tsconfig.worker.json
너무 포괄적이었어요이 경우 수백 개의 "TypeScript 컴파일의 일부지만 사용되지 않음" 메시지가 표시되었습니다. 앱의 모든 ts 파일이 여러 번 나열된 것 같습니다.
원래대로:
"include": [
"src/**/*.worker.ts"
]
장애가 발생한 동작을 중지한 이유:
"files": [ ] # no include or exclude block
제 생각에는 표준적인 tsconfig.app.json의files
이치노TS 컴파일러는 이러한 엔트리 포인트(main.ts 및 polyflites.ts)에서만 모든 *.worker.ts 파일에 대한 참조를 검색하여 파일을 변환할 수 있었습니다."tsconfig" 를 참조해 주세요.webworker.ts는 *.webworker.ts를 사용합니다.왜 그렇게 많은 경고가 쏟아지는지는지 잘 모르겠습니다.아마 웹워커 파일(약 20개)은 불필요하게 사용하지 않는 많은 것을 Import하고 있을 것입니다.
어쨌든, 이 수정으로, 나는 수많은 경고를 없앴고, 우리의 컴파일 시간은 반으로 단축되었다.휴!
저는 이 문제를 해결하기 위해 많은 것을 시도했고, 결국 해결할 수 있었습니다.
나의 문제는 angular 8.1에서 발견된 앱을 angular 9.x로 업데이트하는 것이었는데, 그 앱도 Ionic을 사용했다.
'''만 있으면 .aot: true
에 inside inside inside angular.json
src / polyfiles.ts에서 '.zone-module.ts'를 Import하고 .ts를 삭제합니다.
https://medium.com/ @brits/upgrade-ionic-4-to-ionic-5-14079fb2a여기에 이미지 설명 입력
체크 ★★★★★tsconfig.app.json
filename을 클릭합니다.
다음 콘텐츠가 있는지 확인해보겠습니다.
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
아마도, 비난받을 대목이 이것이었을 것이다.
.
files
★★★★★★★★★★★★★★★★★」include
tsconfig
이 .tsconfig.app.json
:)는 이 에러입니다. :)
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
이게 도움이 됐으면 좋겠어요.
감사해요.
angular 9 앱을 angular 10으로 업데이트한 후 동일한 문제에 직면했습니다.angular-devkit 업데이트로 해결되었습니다.
제 경우 사용하지 않는 파일을 제외하는 것이 더 쉬웠습니다.
"exclude": ["test.ts", "**/*.spec.ts","environments/environment.*.ts"]
이 시나리오에서는 tsconfig.json에 스펙파일이 포함된 제외가 누락되어 있었습니다.이것은 문제를 수정한 tsconfig 파일의 일부입니다.
"exclude": [
"**/*.spec.ts",
"./node_modules/*"
],
"files": [
"src/main.ts",
"src/polyfills.ts"
]
기본적으로 문제는 실행 시 컴파일러가 이러한 파일이 Import되었는지 또는 사용되었는지 여부를 확인하고 그렇지 않은 경우 경고를 발생시킨다는 것입니다.따라서 경고가 environment.ts 파일에 연결되어 있는 경우 위의 설명과 같이 tsconfig.app.json 환경파일을 제외할 수 있지만 Import되지 않은 컴포넌트에 대한 경고가 있는 경우 해당 컴포넌트를 확인하여 사용되지 않는 이유를 확인해야 합니다.필요하지 않은 컴포넌트를 삭제하기만 하면 됩니다.
파티에 늦었다.
이 에러가 발생했습니다.
src/environments/environment.prod.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig
수정하려면 tsconfig.app.json에 이 두 줄을 추가해야 합니다.
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"],
저에게 문제는 다음을 사용하고 있다는 것이었습니다.
loadChildren: () => import('./components/admin/_admin.module').then(m => m.AdminModule)
routes.ts 파일에 저장되었지만 모듈을 Import하지 않았습니다.그래서 만약에 제가
import { AdminModule } from './components/admin/_admin.module';
해결해주죠
언급URL : https://stackoverflow.com/questions/57729518/how-to-get-rid-of-the-warning-ts-file-is-part-of-the-typescript-compilation-but
'sourcecode' 카테고리의 다른 글
인코딩된 암호가 BCrypt와 같지 않습니다. (0) | 2023.02.23 |
---|---|
utf-8의 python jsonify 사전 (0) | 2023.02.23 |
wp_filter는 태그에 영향을 주지 않습니다.</h2 ><p> 테마 <code> functions.php </code> 파일에 다음 필터를 추가했습니다.</p><pre> <code> 함수 변경_the_code() { 'My modified title'을 반환한다.}add_filter wp_filter', '.. (0) | 2023.02.15 |
eslint: 대소문자 구분 없음 - 대소문자 블록의 예기치 않은 어휘 선언 (0) | 2023.02.15 |
Mongoose를 사용하여 MongoDB 문서에서 키 삭제 (0) | 2023.02.15 |