Static Assets

Your components may depend on static assets such as images.

Preview.js automatically lets you import any asset with an import statement:

import icon from "./icon.svg";

If you prefer to use explicit paths instead, you may need to configure a public directory in preview.config.js:

// preview.config.js

import { defineConfig } from "@previewjs/config";

export default defineConfig({
  publicDir: "static",
});