Parcel: how to use inline static images

Created on 3 Jan 2018  路  4Comments  路  Source: parcel-bundler/parcel

Dear Friends,
this is superb library.But i am struggling to inline my static images. Can u please guide me the way.

Regards
gmchaturvedi

Choose one: is this a 馃悰 bug report or 馃檵 feature request?

馃帥 Configuration (.babelrc, package.json, cli command)

{
  "your": { "config": "here" }
}

馃 Expected Behavior

馃槸 Current Behavior

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |
| Node |
| npm/Yarn |
| Operating System |

Question

Most helpful comment

The following code should work, i'm just guessing what ur specific use case is though. This is just a basic JSX example

const someImage = require('./someImage.jpeg');

render() {
  return <img src={someImage} />
}

All 4 comments

Please fill in the issue form

im simply require('./logo.png') but it si not working as its work in webpack and others .KIndly suggest us the best way to use images of local folders.

The following code should work, i'm just guessing what ur specific use case is though. This is just a basic JSX example

const someImage = require('./someImage.jpeg');

render() {
  return <img src={someImage} />
}

thanks its working

Was this page helpful?
0 / 5 - 0 ratings