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.

Failing to require a local image

See original GitHub issue

Tried to include a local image to the basic-setup example and it’s failing to load it. Is this an issue with skpm or just unsupported at this stage?

Thanks!

Executing post-build scripts
error Error while building ./my-command.js
./src/pic.jpg
Module parse failed: /react-sketchapp/examples/basic-setup/src/pic.jpg Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./src/my-command.js 55:70-90
- reactTreeToFlexTree: 0.003
- computeLayout: 0.067
new renderer: 0.083

How to reproduce: <Image source={require('./pic.jpg')} style={{ width: 200, height: 200 }} />

Sketch version: 43.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
blechatelliercommented, Apr 26, 2017

@jongold 👍

After going through the rabbit hole of importing images, I realised that the resolution (2x, 3x) is going to be an issue, I guess it could be parsed and always imported at the highest available resolution. The next question is are pngs/jpgs really appropriate in a design system for things like icons, wouldn’t it be better to import svgs as Sketch can’t tint images. How do you manage icons on your side?

0reactions
LincMitchcommented, Dec 17, 2017

This seems to be an issue in v1.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to show local image using require and webpack
I am struggling to show local images in my react app. I am calling the image inside my render method using the require()...
Read more >
Preloading local images used via require() fails #395 - GitHub
Sometimes with even local images take a short while to load, particularly if there are many images composing full ui i.e. games.
Read more >
Image - React Native
A React component for displaying different types of images, including network images, static resources, temporary local images, and images ...
Read more >
kubelet fails to pull local image while nodes can docker pull ...
kubelet fails to pull local image while nodes can docker pull the images without issues. [SOLVED - WHAT A PAIN IN THE ASS...
Read more >
Kubernetes Troubleshooting - Fixing ImagePullBackOff State ...
Check if you can access the container locally - as a first step you can try pulling the same image from your local...
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