Typescriptはこのインポートでモジュールを見つけられませんimport ga from 'googleAnalytics';
SystemJSは、次のように前もってマップされているため、モジュールの場所を認識しています。
map: {
'@angular': 'node_modules/@angular',
'rxjs': 'node_modules/rxjs',
'underscore': 'node_modules/underscore/underscore-min.js',
'googleAnalytics': '//www.google-analytics.com/analytics.js'
},
に同様のマッピングを提供するにはどうすればよいtsc
ですか?
この他の質問は良い方向を指しているようです: Angular 2 で非常に長い相対パスを持つインポートを回避する方法は?
Typescript 2.0 は のpaths
設定をサポートしているようtsconfig.json
です。Typescript 2.0をダウンロードする方法はありますか? SystemJSpath
で行っているように、構成に http url (//www.google-analytics.com/analytics.js) を指定できますか? Typescript 2.0をダウンロードする方法がない場合、現在のバージョンで目的を達成するにはどうすればよいですか?
編集
私が得る具体的なエラーは、「モジュール 'ga' が見つかりません」です。
これが私のものtsconfig.json
です:
{
"compilerOptions": {
"rootDir": "./",
"target": "es5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true
},
"exclude": [
"node_modules",
"front-end/node_modules",
"typings/main",
"typings/main.d.ts"
]
}