Introduction

This module is intended for use when building Velo packages in Wix Blocks.

To use the module, import { getPackageConfig } from wix-configs-backend:

Copy
import { getPackageConfig } from "wix-configs-backend";

When you build a Velo package, you can include a config.json file. Users of the package can edit this file and add personalized information such as settings preferences. The wix-configs-backend module allows you to access the contents of the config.json file in your package code, using the getPackageConfig() function.

Did this help?

getPackageConfig( )


Retrieves the value of a specific key in a package's config.json file.

The getPackageConfig() function returns a Promise that resolves to the value of a key in a package's config.json file.

When you build a Velo package, you can include a config.json file. Users of the package can edit this file and add personalized information such as settings preferences. The getPackageConfig() function allows you to access the contents of the config.json file in your package code.

Method Declaration
Copy
function getPackageConfig(key: string): Promise<any>;
Method Parameters
keystringRequired

The config.json key whose value you want to retrieve.

Returns
Return Type:Promise<any>
Retreive a user's ID number from a package's config.json file
JavaScript
import { getPackageConfig } from "wix-configs-backend"; // ... const userId = getPackageConfig("id");
Did this help?