A Mosaic site is a Next.Js app.
To publish a Next.Js App to Vercel, refer to the Vercel docs.
As the vercel platform hosts static content you will need to deploy a mosaic snapshot. There is no option to run mosaic in active mode.
Add the following to the mosaic config file used by your site:
Set 2 environment variables in the vercel dashboard.
Variable Name | Value |
---|---|
MOSAIC_MODE | snapshot-file |
MOSAIC_SNAPSHOT_DIR | snapshots/latest. |
The build
command used by vercel must run yarn build
followed by yarn deploy
The deploy
command is needed to workaround an output file tracing problem.
Example:
Output File Tracing is a feature of Next.js that uses static analysis to determine what files are needed to deploy a production version of an application.
Due to the architecture of mosaic, snapshot files can be ignored by this process and therefore excluded from the build artifacts deployed by vercel.
If you are deploying your site to the vercel platform then the mosaic site has a deploy
command that will update the nextjs output trace to include the snapshot files.