Type object
File match cosmos.config.json
Schema URL https://catalog.lintel.tools/schemas/schemastore/cosmos-config-json/latest.json
Source https://www.schemastore.org/cosmos-config.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Properties

$schema string
rootDir string

The root directory that all others paths in this config are relative to. Usually the root of your repo. If omitted, rootDir is equal to the directory containing your Cosmos config. When you don't use a Cosmos config, rootDir defaults to the current working directory.

minLength=1
exportPath string

Where to generate static exports on disk. [default: "cosmos-export"]

minLength=1
detectLocalPlugins boolean

Automatically detect and load local plugins

disablePlugins boolean

Disable plugins

staticPath string

Dir path to serve static assets from.

minLength=1
plugins string[]

Module IDs of Cosmos plugins (eg. "react-cosmos-plugin-open-fixture" or "../path/to/my-plugin").

uniqueItems=true
publicUrl string

Base URL for static assets. [default: "/"]

fixturesDir string

Name for directories that contain fixtures (eg. fixtures/example.jsx). [default: "fixtures"]

minLength=1
fixtureFileSuffix string

Suffix for fixture files (eg. example.fixture.jsx). [default: "fixture"]

minLength=1
ignore string[]

Patterns for ignoring fixture and decorator files (eg. ["/dist/"]]).

uniqueItems=true
watchDirs string[]

Directories where the Cosmos server watches for fixture files changes while running. [default: ["."]]

uniqueItems=true
lazy boolean

Dynamically import fixture and decorator modules as they are loaded. When false all fixture and decorator modules are imported statically and bundled together. [default: false]

exposeImports string | boolean

Expose user imports and config required for the Cosmos renderer. Used with React Native and in custom integrations. When a path is specified it requires a file extension (eg. "src/cosmos.imports.ts"). [default: false]

hostname string | null

Dev server hostname. Set to null to accept connections with any hostname. [default: null]

port number

Dev server port. [default: 5000]

portRetries number

Max number of port retries. [default: 10]

https boolean

Server will be served over HTTPS.

httpsOptions object

Additional options for HTTPS server.

2 nested properties
certPath string

Path of a certificate file

keyPath string

Path of a certificate's key file

httpProxy object

Proxy some URLs to a different HTTP server (eg. an API backend dev server). Similar to devServer.proxy in webpack config.

globalImports string[]

Modules to be imported before loading components. Stuff like reset.css, polyfills, etc.

uniqueItems=true
rendererUrl string | null

Required when renderer doesn't run on the same port (or host) as the Playground. Useful for integrations with build tools. [default: null]

dom object

DOM-related options

1 nested properties
containerQuerySelector string | null

Document selector for existing element to use as component parent (eg. #root). A blank container element is created from scratch if no selector is provided. [default: null]

minLength=1
vite object

Vite-related options

3 nested properties
configPath string | enum

Path to Vite config. Set to false to disable reading it from the default path. [default: "vite.config.js"]

indexPath string | null

Path to index module (eg. "src/my-index.tsx"). [default: matches common index/main module paths]

port number

Vite renderer port. [default: 5050]

webpack object

Webpack-related options

5 nested properties
configPath string | null

Path to an existing webpack config, which Cosmos will reuse to build your code. Set to null to disable this behavior. [default: "webpack.config.js"]

overridePath string | null

Path to a user module that customizes the webpack config used by Cosmos. Set to null to disable this behavior. [default: "webpack.override.js"]

includeHashInOutputFilename boolean

Changes output filename from "[name].js" to "[name].[contenthash].js". [default: false]

hotReload boolean

Enable webpack's Hot Module Replacement. [default: true]

reloadOnFail boolean

When using webpack's Hot Module Replacement, enable automatic location reload after webpack fails to update modules. [default: false]

ui object

UI plugin options

1 nested properties
responsivePreview object
1 nested properties
devices object[]

List of device viewports