Documentation
Feedback
Guides

Release Notes
Release Notes
Declaring blocks stemming from indirect dependencies
December, 12

The Store Builder now requires all blocks that are used in the construction of a Store Theme to be defined by the direct dependencies of the app in which you are working, without exception.

What has changed

Prior to this release, an app could use blocks stemming from apps not declared as its dependency in the manifest.json.

To further understand this scenario, we'll consider the existence of three apps: A, B and C.

{"base64":"  ","img":{"width":2112,"height":964,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":96591,"url":"https://user-images.githubusercontent.com/52087100/70732501-4cd0d900-1ce7-11ea-9e8e-f70415b91921.png"}}

According to the old scenario, app A could use blocks that were defined by app C once the latter is a direct dependent of app B and B a direct dependent of A.

Now, the Store Builder only looks at how a block is defined in the app's direct dependents list. This means that an app can only use blocks defined by apps that are declared as dependencies in its manifest.json.

Therefore, in our example above, app A can no longer import blocks from app C, because it can only use blocks that are defined by app B.

Why is this action being taken

Using blocks that were defined in direct and indirect dependencies freely led to app consistency problems.

As the Store Builder was searching throughout the entire dependencies tree (meaning indirect and direct dependencies) for the definition of the blocks that were used, it was possible for an app from this long list to define the same block as other apps. This in turn confused the Store Builder as to which version you wanted to export the desired block from.

In addition to conflicts that could, within the realm of possibility, be reversed, using a defined block in an app that wasn't declared in the manifest.json also meant increased fragility for the main app.

Following the same example with apps A, B and C above: it was possible for a developer working on app C to decide to remove a block used by app A, thereby breaking the template construction of the latter. According to the Store Builder's old behavior, the developer would not be aware of what other apps were exporting blocks due to an indirect relationship with C.

This release therefore allows for an app's behavior to become more predictable and resilient to errors, as all block that are used have their origin clearly stated and are controlled by the designated developer through the app's manifest.json.

Side effects

If you're still using indirect dependency blocks, you won't be able to link and publish the app in which you are working. Instead, the following error will be displayed:


_10
error: App build failed with message: Error resolving block "store.product":
_10
I couldn't find a block "product-reviews".
_10
You need to declare it or depend on an app that declares it.

What you need to do

Starting from this release, it is mandatory to declare in the in manifest.json all apps that define the blocks used in your theme.

Was this helpful?
Yes
No
On this page