Configuring the Static Server Root Path

Important!
if you're working on a specific package in a monorepo, you'll need to use this configuration to serve assets that are outside your package.
The staticServerRoot configuration key for codux.config.json lets you set the path to the folder where your static files (like images or fonts) are stored. This is handy when you're using a static file server (like Vite's public directory) or working on a single package in a larger project (like a monorepo).
In your codux.config.json file, it might look like this:
1
2
3
4
5
{  
  "$schema": "https://wixplosives.github.io/codux-config-schema/codux.config.schema.json",
  ...
  "staticServerRoot": "./public"
}  
With this setup, you can use images from your public folder like this:
1
2
3
4
5
<Image
    src={'/images/cover-image.png'}
    width={240}
    height={0}
    alt="Talisa Kidd"/>
In this case, the cover-image.png image is served from the ./public/images directory, which is relative to where your codux.config.json file is located.