2017-06-12 7 views
1

英雄チュートリアルhttps://angular.io/docs/ts/latest/guide/setup.htmlのツアーからプロジェクトをクローンしました。TypeScriptとJavaScriptファイルを分ける

そして、.tsファイルと.jsファイルと.js.mapファイルを1つのディレクトリにまとめているので、.jsファイルを別のディレクトリに分割したいと思います。

私は答えから、次のそれを解決しようとした:Separate Angular2 TypeScript files and JavaScript files into different folders, maybe 'dist‘しかしsystemjs.config.jsの変化とtsconfig.json後、私はエラーを取得する:

Failed to load resource: the server responded with a status of 404 (Not Found) 
localhost/:18 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/app/app.module 
    Error: XHR error (404 Not Found) loading http://localhost:3000/app/app.module 
     at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1056:39) 
     at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:424:31) 
     at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:191:47) 
     at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:486:38) 
    Error loading http://localhost:3000/app/app.module as "./app/app.module" from http://localhost:3000/main.js 
     at XMLHttpRequest.wrapFn [as __zone_symbol___onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1056:39) 
     at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:424:31) 
     at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:191:47) 
     at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:486:38) 
    Error loading http://localhost:3000/app/app.module as "./app/app.module" from http://localhost:3000/main.js 
+0

どのIDEを使用していますか? – alehn96

+0

ビジュアルスタジオコード – user

+0

ほとんどのエディタは、 '.js'と' .js.map' 'folded'を入れ、typescriptが使用されていることを検出すると非表示にします。今日はあなたが記述しているディレクトリとは別のディレクトリにあることは稀です。 – Raven

答えて

3

ユーザーに

"files.exclude": { 
    "**/*.js.map": true, 
    "**/*.js": { 
     "when": "$(basename).ts" 
    } 
}, 

を追加します。設定

+0

私は問題があります。 私のプライマリディレクトリはappです。そして、このディレクトリにすべての.tsファイルがあると、.jsファイルと.js.mapファイルは表示されません。しかし、ディレクトリapp/subdir /サブディレクトリを作成してそこに.tsファイルを置くと、ディレクトリappに.jsファイルがあります。 – user

関連する問題