Skip to content

PNG Static Assets #1281

@dariuscosden

Description

@dariuscosden

The documentation shows how to import a static SVG file, however I am not able to get it working with a PNG file.

I am not sure what format I need to provide the image in. I have tried raw bytes, base64, and am not getting any results.

Please advise and ideally update the documentation to show how to handle different kinds of file formats for static assets if they require different data.

<Sandpack
    files={{
      "/public/image.png": "", // What do I provide here?
      "/App.js": `export default function App() {
  return (
    <>
      <h1>Hello React</h1>
      <img width="100" src="/public/image.png" />
    </>
  );
}
      `,
    }}
    options={{
      experimental_enableServiceWorker: true,
    }}
    template="react"
  />

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew issues that needs consideration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions