We can leverage a component to load external scripts in an app/extension.

You can install an additional component to load external scripts in an app/extension. This component is located in the SmartBuilder SDK package. ⬇️

~~SmartBuilder SDK Url package: https://app-assets-unbounce-com.s3.amazonaws.com/content-smart-builder-apps/smart-builder-sdk-1.0.2.tgz~~

<aside> 🔔 IMPORTANT The Smart Builder SDK package is on hold at the moment, with the potential to be deprecated. However, all the available functionality from smart-builder-sdk is still available via the new global dependency configurations from /config/global-dependencies/smart-builder-sdk.ts. The sample repo will also have the alias set up in tsconfig.json so that imports can be done via smart-builder-sdk.

March 29, 2022: Types are available via a new NPM package. Run npm i -D unbounce-smart-builder-sdk-types to use the types available.

****Do double-check that you install the latest version of this package. At the time of writing this documentation, we installed the 1.0.2 version.

</aside>


We will work with underscorejs as an external script in this example.

CDN: https://unpkg.com/[email protected]/underscore-umd-min.js

At this time, our SDK does not support external libraries that require CSS. Our teams are working hard on improving this for the future.

Imports

We’ll first start by adding these imports where we plan to use the component:

import { Script } from 'smart-builder-sdk';