Resources

The resources property declares the code and assets that make up your component.

You can only define resources at the root level of your manifest, alongside properties like type and editorElement. The resources property is required, and at minimum, you need client.componentUrl.

When you build with the CLI, it handles resource management automatically: bundling your code, uploading assets, and generating the resource URLs.

Resources properties

The resources object supports the following fields:

clientClientRequired

Component bundle and assets for the live site.


editorEditor

Component bundle and assets for the editor. Use when your component needs editor-specific behaviors like displaying hover states, showing expanded views, or rendering mock data.


serverServer

Component bundle for server-side rendering (SSR), improving initial load performance and SEO.


sdkSDK

SDK bundle that exposes your component's API to site developers through the $w API for programmatic interaction.


Important: Your server bundle must avoid browser-specific APIs like window and document. If your component relies on these APIs, provide a fallback that renders static content on the server.

Examples

Minimal resources

The simplest configuration, with only the required client.componentUrl:

Copy

Client with default CSS

A client bundle with a CSS file. The CSS is rendered once per page, regardless of how many instances of the component exist:

Copy

Client and editor bundles

Separate bundles for the live site and the editor:

Copy

Full resources configuration

A complete resources object with all supported fields:

Copy

See also

Did this help?