{"id":2671,"date":"2022-05-30T12:25:21","date_gmt":"2022-05-30T10:25:21","guid":{"rendered":"https:\/\/ekiwi.de\/?p=2671"},"modified":"2022-05-30T12:25:21","modified_gmt":"2022-05-30T10:25:21","slug":"visual-studio-code-und-react-png-bild-wird-nicht-gefunden","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/2671\/visual-studio-code-und-react-png-bild-wird-nicht-gefunden\/","title":{"rendered":"Visual Studio Code und React: PNG Bild wird nicht gefunden"},"content":{"rendered":"<p>&#8222;Cannot find module \u2026 or ist corresponding type declarations&#8220; Fehler beim Einbinden von Bildern in Visual Studio Code.<\/p>\n<p><!--more--><\/p>\n<p>In einer React-App hatte ich einen Fehler in Visual Studio Code. Bilder konnten nicht gefunden werden. Der Fehler wurde nur in VS Code angezeigt. Die Anwendung lief trotzdem problemlos und auch die Bilder wurden angezeigt.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/05\/vscode_1.png\" alt=\"\" width=\"803\" height=\"70\" class=\"alignnone size-full wp-image-2672\" srcset=\"\/wp-content\/uploads\/2022\/05\/vscode_1.png 803w, \/wp-content\/uploads\/2022\/05\/vscode_1-300x26.png 300w, \/wp-content\/uploads\/2022\/05\/vscode_1-768x67.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<h2>Die L\u00f6sung<\/h2>\n<p>Die L\u00f6sung ist in diesem Fall im &#8222;src&#8220; Ordner eine Datei mit dem Namen &#8222;global.d.ts&#8220; zu erstellen. Der Inhalt:<\/p>\n<pre>declare module &quot;*.png&quot; {\r\n    export default &quot;&quot; as string\r\n}<\/pre>\n<p>Anschlie\u00dfend war die Warnung weg.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/05\/vscode_2.png\" alt=\"\" width=\"290\" height=\"122\" class=\"alignnone size-full wp-image-2673\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>&#8222;Cannot find module \u2026 or ist corresponding type declarations&#8220; Fehler beim Einbinden von Bildern in Visual Studio Code.<\/p>\n","protected":false},"author":1,"featured_media":2260,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[15],"tags":[44,561,711],"class_list":["post-2671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript","tag-react","tag-vscode"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=2671"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2671\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/2260"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=2671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=2671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=2671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}