Dependencies

📘

Note

Custom dependencies are only supported in @tapcart/tapcart-cli^0.1.10

Tapcart supports importing most software packages to your custom blocks via the CLI.

🚧

React Component libraries are not supported

The Tapcart ecosystem does not support React component libraries like @mui/material. For UI components, you should use the Tapcart component library.


Installing dependencies

This is done by adding the
dependencies to your project via tapcart dependency add command. For example:

yarn tapcart dependency add lodash 4.17.21

This will add the lodash library to your app's dependencies. You must specify
which blocks you want to add the dependency to. This is done by editing the block's config.json file.


{
  "dependencies": ["lodash"]
}

Then, you can import the dependency in your block's code.jsx file:

import * as _ from 'lodash';

Pushing Dependencies

📘

Note

You must push dependencies to your application configuration so that your blocks will render correctly in the dashboard or mobile app.


yarn tapcart dependency push

This will push the dependencies to your application configuration.


Troubleshooting

Under the hood, dynamic imports are retrieved from esm.sh's CDN. You can test whether your package version will work by visiting https://esm.sh/PACKAGE_NAME@SEM_VER.