サーバー側でレンダリングされた構成を ES6 モジュールとして、インポートできる TypeScript アプリケーションに渡したいです。SystemJS モジュール ローダーを使用します。
config モジュールは index.html で直接設定されます。
System.set(System.normalizeSync('config'), System.newModule({ foo: 'bar' })); // in the real scenario the { foo: 'bar' } is rendered by the server
次にmain.tsで
import { foo } from 'config';
SystemJS は構成モジュールを認識しますが、TypeScript コンパイラは不平を言うため、これはブラウザーで機能します。
モジュール 'config' が見つかりません。
index.htmlで定義された「外部」カスタムモジュールについてTypeScriptに伝える方法は?