2016-07-17 13 views
0

npmを使ってビルドスクリプトを作成しようとしています。npm - npmビルドスクリプトでtypescriptファイルをコンパイルします。

ほとんどのものは、typescriptを連結することとは別に動作しています。

私は1つのタイスクリプトファイルをコンパイルできますが、私は連結してコンパイルする必要があるいくつかの別々のファイルがあります。

私はconcat-cli mobuleを使用していますが、ファイルを連結するようではなく、フォルダ内の最初のファイルを出力するだけです。

タイスクリプトファイルを連結するにはどのような方法が最適ですか。

{ 
     "name": "starter", 
     "version": "1.0.0", 
     "description": "", 
     "main": "index.js", 

     "scripts": { 
     "scss": "node-sass --output-style compressed -o src/assets/css src/assets/sass/main.scss", 
     "compile:ts": "tsc --outDir ./src/assets/js/ --module commonjs ./src/app/**/*.ts", 
     "concat:ts": "concat-cli --files src/app/**/*.ts --output dist/js/output.ts", 
     "serve": "browser-sync start --server --files 'src/assets/css/, src/assets/js/*.js, **/*.html, !node_modules/**/*.html'", 
     "watch:css": "onchange 'src/assets/sass/*.scss' -- npm run scss", 
     "watch:js": "onchange 'src/app/**/*.js' -- npm run jshint", 
     "watch:ts": "onchange 'src/app/**/*.ts' -- npm run concat:ts", 
     "watch:all": "npm-run-all -p serve watch:css watch:js watch:images", 
     }, 
     "author": "", 
     "license": "ISC", 
     "devDependencies": { 
     "browser-sync": "^2.13.0", 
     "concat": "0.0.1-security", 
     "concat-cli": "^4.0.0", 
     "node-sass": "^3.8.0", 
     "onchange": "^2.5.0", 
     "typescript": "^1.8.10", 
     } 
    } 

答えて

1

typescriptですファイルを連結するためにどのような最善の方法。

モジュールを使用し、webpackのようなモジュールローダーを使用します。クイックスタート:https://basarat.gitbooks.io/typescript/content/docs/quick/browser.html

なぜ盲目的ReferenceError: Variable not definedTypeError : undefined is ....でいっぱいになりますモジュールシステムを使用せずに、JSファイルを連結

。他にもメンテナンスの理由があります。その他:https://basarat.gitbooks.io/typescript/content/docs/tips/outFile.html

+0

webpack.config.jsでglobを使用できますか?私は、私のangularjsコードのコントローラ、ディレクティブ、サービス、フィルタフォルダを持つappフォルダを持っています。だから私は 'entry: 'を使ってコンパイルする必要があるさまざまなタイスクリプトファイルを持っている./src/app/ **/*。ts'、'エラーが出る – ttmt

関連する問題