Skip to main content

Static Assets

Your components may depend on static assets such as images. React Preview 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 reactpreview.config.js:

/reactpreview.config.js
const reactpreview = require("@reactpreview/config");
module.exports = reactpreview.config({  publicDir: "static",});