question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When requiring an image path I have to add .default

See original GitHub issue

When importing an SVG I can require the path just fine

src={require("../assets/svg/dij-slash.svg")}

But when importing a jpg I have to import it like this:

image={require("../assets/img/content/diensten-support.jpg").default}

Notice the .default at the end. Is this intended?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
durchanekcommented, Apr 14, 2020

Found this happening for images that are not inlined, either because they are too large or because ?url is set. Filetype doesn’t seem to matter, happening with SVGs too. Quite problematic because the image can break when its file size changes. Tested in 2.5.8-canary.1

1reaction
l3v1kcommented, May 22, 2020

This isn’t fixed issue for me, but I’ve fixed it by disabling fallback to url-loader through option inlineImageLimit: -1. Think there may be issue with url-loader’s default config?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Default image if no record with image path on database
we can try set by-default value to database column img_local (Ex. default.png) , so if user not change image or there is no...
Read more >
Default 'insert image' path? - Adobe Support Community
I quickly setup a toolbar with just 'Insert Image' & 'Create DD Hotspot' buttons, and flip between CTRL+G and the toolbar for images...
Read more >
Default image path | Drupal.org
I am new to Drupal. I am struggling with quite a few things but my present major one is defining the Default Image...
Read more >
How to require() a image only if it exist or else ... - Vue Forum
Hi, I 'm new to vue.js, nuxt.js, webpack tooling. ... let defaultImage = "@/assets/img/beer-default.png" // just set default let path ...
Read more >
Require Image Not Working in ReactJS - YouTube
I have got images folder with images in it. I recently noticed react require ... We can resolve it by adding default after...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found