Skip to content
ESM
import { getAssetPath, setAssetPath } from "@arcgis/ai-components/index.js";

Functions

NameReturn TypeObject

getAssetPath

Function

Get a resolved path from where an asset can be loaded.

Signature
getAssetPath (suffix: string): string
Parameters
ParameterTypeDescriptionRequired
suffix

The relative path for the asset.

Returns
string

setAssetPath

Function

Used to manually set the base path where package assets (like localization and icons) can be found.

By default, the package assets are loaded from https://js.arcgis.com/<version>/<simplified-package-name>/. We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access. It is CORS-enabled, so you can load the assets from any domain. This is the recommended way to load the assets and avoid bundling them with your application.

However, if you need to host the assets locally, you can copy them manually as part of your build process and use setAssetPath to customize where the browser will load the assets from.

Signature
setAssetPath (path: URL | string): void
Parameters
ParameterTypeDescriptionRequired
path

Relative or absolute path to the assets folder.

Returns
void