Dev Guide
Dev GuideUser GuideGitHubNuGetDevCommunitySubmit a ticketLog In
GitHubNuGetDevCommunitySubmit a ticket

Add a dependency

Add a dependency to your Optimizely Connect Platform (OCP) application.

Optimizely Connect Platform (OCP) apps have a set of pre-defined dependencies in the package.json file. You can add your own dependencies by using the npm install or yarn add command, or by manually editing the package.json file.

Add a dependency

For example, OCP apps come with the node-fetch library to make HTTP calls. If you prefer to use the axios libray instead, you can add it to your app by running the following command:

npm install axios

Add a dev dependency

If a dependency is only required at build and test time, for example, a testing library like mocha, you can add it as a dev dependency:

npm install --save-dev mocha

📘

Note

All OCP apps come with the jest library by default (for testing).

For dependencies without types, you should add TypeScript type definitions to your dev dependencies. Alternatively, you can manually add either production or dev dependencies by manually editing the package.json file.

📘

Note

You can add any dependency available in the public NPM repository. OCP does not support dependencies in private repositories; they can work locally, but the build will fail when you push your app to OCP.