1
我試圖設立Angular2和SystemJs,例如從外部庫,這是像這樣定義的,我可以導入組件構建環境:力打字稿承認__moduleName
@Component({
moduleId: __moduleName,
selector: 'foo-selector',
templateUrl: 'foo.component.html'
})
我知道肯定這是我想要使用的,因爲它在我運行它時起作用。但是Typescript編譯失敗,因爲它無法識別moduleName
。我怎麼能告訴Typescript認識到這一點,或者至少不要抱怨呢?
這是打字稿版本2.1.0-dev.20160915和module
在tsconfig.json
我有同樣的問題......但在我的情況下,沒有編譯錯誤..但在瀏覽器中我得到'localhost /:23錯誤:(SystemJS)__moduleName未定義'...有沒有解決方案? – Guna
你的tsconfig.json是什麼樣的?具體地說'compilerOptions.module'部 – yurzui
是啊..像這樣, 「compilerOptions」:{ 「目標」: 「ES5」, 「模塊」: 「AMD」, 「moduleResolution」: 「節點」} – Guna