Static Assets

Your components may depend on static assets such as images.

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

If you prefer to use explicit paths instead, you may need to configure a public directory.

This is done via the publicDir property in preview.config.js:

// preview.config.js

/** @type {import("@previewjs/config").PreviewConfig} */
module.exports = {
  publicDir: "static",
};