2016-11-07 4 views
1

ng-xi18n 도구를 사용하여 i18n 파일을 만듭니다. "./node_modules/.bin/ng-xi18n" messages.xlf 파일이 생성되면 실행됩니다. 문제는 모든 코드가 컴파일된다는 것입니다. js, js.map, metadata.json 파일이 생성되었으므로 필요하지 않습니다. Hoe가 js, js.map 및 metadta.json 파일없이 messages.xlf를 작성 하시겠습니까?코드 컴파일이없는 각도 2 내부화 (ng-xi18n 도구)

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "allowSyntheticDefaultImports": true, 
    "sourceMap": true, 
    "noEmitHelpers": true, 
    "strictNullChecks": false, 
    "baseUrl": "./src", 
    "paths": { 
    }, 
    "lib": [ 
     "dom", 
     "es6" 
    ], 
    "types": [ 
     "hammerjs", 
     "jasmine", 
     "node", 
     "protractor", 
     "selenium-webdriver", 
     "source-map", 
     "uglify-js", 
     "webpack" 
    ] 
    }, 
    "exclude": [ 
    "node_modules", 
    "dist" 
    ], 
    "awesomeTypescriptLoaderOptions": { 
    "forkChecker": true, 
    "useWebpackText": true 
    }, 
    "compileOnSave": false, 
    "buildOnSave": false, 
    "atom": { "rewriteTsconfig": false } 
} 

답변

1

이 실제로 도구에서 열린 문제 : 다음

내 tsconfig.json입니다

https://github.com/angular/angular/issues/13567

해결 방법으로, 나는 실행하는 NPM 스크립트를 구현했습니다 ng-xi18n 및 생성 된 파일을 제거하십시오. 당신의 package.json 다음을 추가 scripts 섹션에서

:

"scripts": { 
    "i18n": "ng-xi18n && npm run clean:i18n", 
    "clean:i18n": "rimraf ClientApp/**/*.js ClientApp/**/*.js.map ClientApp/**/*.metadata.json" 
} 

그럼 당신은 추출 및 정리 작업을 수행 할 수 npm run i18n을 발행 할 수 있습니다.

주 : 내 설정에서

  • , 나는 그래서 내가 그 폴더에서 시작하여 삭제를 대상으로하고있어, 프로젝트 폴더의 루트에 ClientApp 폴더에있는 모든 각도 관련 코드를했습니다.
  • 그 폴더에있는 .js 파일에 의존하지 않으므로 안전하게 삭제할 수 있습니다. 당신이 보존하고 globbing 패턴을 적절히 조정하고자하는 자바 스크립트 파일을 가지고 있다면 이것을 고려하십시오.
  • rimraf을 종속성으로 (또는 dev 종속성이 바람직 함) 추가해야합니다.

희망 사항은 버그가 수정 될 때까지 도움이됩니다.

건배!

+0

컴파일러 [문제] (https://github.com/angular/angular/pull/14115)입니다. Angular 4로 고정됩니다. – Luka