cosmos.config.json
React Cosmos configuration file
cosmos.config.json
Validate
Check your file against this schema
Opens the validator with this schema already loaded. Paste your
cosmos.config.json and it validates in your browser — nothing is uploaded.
Reference
Fields
Generated directly from the schema, following local
$refs, to two levels of nesting.
| Field | Type | Description |
|---|---|---|
$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 |
exportPath | string | Where to generate static exports on disk. [default: "cosmos-export"] |
detectLocalPlugins | boolean | Automatically detect and load local plugins |
disablePlugins | boolean | Disable plugins |
staticPath | string | Dir path to serve static assets from. |
plugins | array<string> | Module IDs of Cosmos plugins (eg. "react-cosmos-plugin-open-fixture" or "../path/to/my-plugin"). |
publicUrl | string | Base URL for static assets. [default: "/"] |
fixturesDir | string | Name for directories that contain fixtures (eg. __fixtures__/example.jsx). [default: "__fixtures__"] |
fixtureFileSuffix | string | Suffix for fixture files (eg. example.fixture.jsx). [default: "fixture"] |
ignore | array<string> | Patterns for ignoring fixture and decorator files (eg. ["**/dist/**"]]). |
watchDirs | array<string> | Directories where the Cosmos server watches for fixture files changes while running. [default: ["."]] |
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 | anyOf | 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 | anyOf | 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. |
httpsOptions.certPath | string | Path of a certificate file |
httpsOptions.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 | array<string> | Modules to be imported before loading components. Stuff like reset.css, polyfills, etc. |
rendererUrl | anyOf | 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 |
dom.containerQuerySelector | anyOf | 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] |
vite | object | Vite-related options |
vite.configPath | anyOf | Path to Vite config. Set to false to disable reading it from the default path. [default: "vite.config.js"] |
vite.indexPath | anyOf | Path to index module (eg. "src/my-index.tsx"). [default: matches common index/main module paths] |
vite.port | number | Vite renderer port. [default: 5050] |
webpack | object | Webpack-related options |
webpack.configPath | anyOf | 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"] |
webpack.overridePath | anyOf | Path to a user module that customizes the webpack config used by Cosmos. Set to null to disable this behavior. [default: "webpack.override.js"] |
webpack.includeHashInOutputFilename | boolean | Changes output filename from "[name].js" to "[name].[contenthash].js". [default: false] |
webpack.hotReload | boolean | Enable webpack's Hot Module Replacement. [default: true] |
webpack.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 |
ui.responsivePreview | object | — |
ui.responsivePreview.devices | array<object> | List of device viewports |
Audit
What we found in this schema
- Declared draft: draft-07
- Validates cleanly against its own meta-schema.
- 46 properties, 80% carrying a description, max nesting depth 11.
Standards
Specification sections for the keywords in this schema
| Keyword | Document | Section |
|---|---|---|
$id | JSON Schema Core, draft 2020-12 | §8.2.1 — The "$id" Keyword |
$schema | JSON Schema Core, draft 2020-12 | §8.1.1 — "$schema" |
additionalProperties | JSON Schema Core, draft 2020-12 | §10.3.2.3 — "additionalProperties" |
anyOf | JSON Schema Core, draft 2020-12 | §10.2.1.2 — "anyOf" |
description | JSON Schema Validation, draft 2020-12 | §9.1 — "title" and "description" |
items | JSON Schema Core, draft 2020-12 | §10.3.1.2 — "items" |
minLength | JSON Schema Validation, draft 2020-12 | §6.3.2 — "minLength" |
minimum | JSON Schema Validation, draft 2020-12 | §6.2.4 — "minimum" |
patternProperties | JSON Schema Core, draft 2020-12 | §10.3.2.2 — "patternProperties" |
properties | JSON Schema Core, draft 2020-12 | §10.3.2.1 — "properties" |
required | JSON Schema Validation, draft 2020-12 | §6.5.3 — "required" |
type | JSON Schema Validation, draft 2020-12 | §6.1.1 — "type" |
uniqueItems | JSON Schema Validation, draft 2020-12 | §6.4.3 — "uniqueItems" |
Documents
- JSON Schema Core, draft 2020-12 — JSON Schema: A Media Type for Describing JSON Documents, A. Wright, H. Andrews, B. Hutton, G. Dennis, Eds., 2022. draft-bhutton-json-schema-01. An expired Internet-Draft with no formal standing in the IETF standards process; it is nonetheless the specification of record for JSON Schema 2020-12, published by json-schema.org.
- JSON Schema Validation, draft 2020-12 — JSON Schema Validation: A Vocabulary for Structural Validation of JSON, A. Wright, H. Andrews, B. Hutton, Eds., 2022.
- RFC 8259 (STD 90) — The JavaScript Object Notation (JSON) Data Interchange Format, T. Bray, Ed., 2017. The format a schema describes.
- RFC 6901 — JavaScript Object Notation (JSON) Pointer. Defines the pointer syntax used by $ref fragments and the ~0 / ~1 escapes.
Source
Attribution
This schema comes from SchemaStore, distributed under the Apache License 2.0. Copyright 2015–present Mads Kristensen and contributors. View the original file. The field table and audit on this page are generated by JSONTools.tools; the schema itself is unmodified.