0

リポジトリの例https://github.com/github0013/typescript_react

tag に埋め込まれた base64 文字列で画像を読み込む必要がありますが、画像ファイルをインポートするとこのエラーが発生します。

TS2307: モジュール './Octocat.jpg' が見つかりません。

https://github.com/github0013/typescript_react/commit/6670f3ca74404007ad1ed6e4ab0d111f547ee75d

私はまだtypescript、webpack、およびreactに慣れていません。typescriptとimportwebpackを混同していると確信しています。

url-loader画像を有効にするにはどうすればよいですか? これは有効ですか? https://github.com/github0013/typescript_react/blob/master/config/webpack/environment.js

--
試してみrequireましたが、base64 の攪拌ではなく、画像のパスを返すだけです。

// global.d.ts
declare function require(string): string;
4

1 に答える 1