Install a local extension
Follow these steps in order to install an extension from a local source
First of all, download the extension
Create a packages/ directory inside of your theme's root.
Put the extension into the packages/<package name> directory. Make sure that you have a packages/<package name>/package.json file present alongside all the other extension's contents, that means that you have unpacked the extension correctly.
.
βββ π packages/
β βββ π @somebody/ # All extensions of this scope will be in this dir
β β βββ π extension1/ # This extension is a scoped package
β β βββ ...
β β βββ package.json
β βββ π extension2/ # This extension is not a scoped package
β βββ ...
β βββ package.json
βββ π src
βββ package.jsonAdd the following scripts to the scripts section of your theme's package.json file. This is necessary for your package to be automatically symlinked into the node_modules directory of your theme, each time after any manipulation with dependencies
{
"scripts": {
"postinstall": "nextjs-scripts link",
"postupdate": "nextjs-scripts link"
}
}{
"scripts": {
"postinstall": "cra-scripts link",
"postupdate": "cra-scripts link"
}
}{
"scripts": {
"postinstall": "node-scripts link",
"postupdate": "node-scripts link"
}
}Add the extension to the dependencies of your theme, as follows:
Enable the extension:
Update the symlinks by running the following command
Last updated
Was this helpful?