Generating a JSS app manifest file
When you have defined all the code-first artifacts of your JSS application, such as routes, route types, placeholders, components, component content, and so on, you can generate a manifest that holds the complete manifest definition.
You can generate a JSS app manifest manually, by running the JSS CLI command jss manifest
.
However, if you are not debugging the manifest generation process, it is more common that the manifest is generated automatically:
-
During the start-up of the disconnected development serve, usually by running the command
jss start
. The disconnected development server watches the foldersitecore/definitions
and rebuilds the manifest when you add, remove or change manifest definitions. -
During deployment or packaging of JSS artifacts to Sitecore using a JSS CLI command, when you use the JSS CLI commands
jss deploy items
orjss package
. If you do not want to generate a manifest, you can use the--skipManifest
argument.
By default, the JSS manifest in sample applications is emitted to the folder sitecore/manifest
.
The manifest is generated with the following process:
-
JSS locates all
/sitecore/definitions/*.sitecore.{js|ts}
manifest files in your application. -
JSS iterates over the manifest files, invoking the
default
export of each file. Thedefault
export is expected to be a function with the signature:function(manifest) { }
. -
Each
*.sitecore.{js|ts}
file invokes various methods on themanifest
instance received by thedefault
function, such asaddComponent
oraddRoute
. -
After processing all
*.sitecore.{js|ts}
files, JSS generates the manifest output through a series of pipelines and writes the output to/sitecore/manifest
or to the console, if you provide the parameter--manifestOutputPath console
.
The manifest generation process supports transpiled (ES6/TypeScript) manifest sources. In the sample apps, you can find the transpilers' default settings in /sitecore/definitions/config.js
. You can override this path with the --require
argument to the CLI command that generates the manifest.