While we've all been enjoying our holidays, SAP released Spartacus 4.0 on July 29, 2021. In this article, I’d like to give you a summary of what it contains and how to approach the migration.
Not feature heavy
Spartacus 4.0 is mostly about cleaning up the source code in order to streamline future development. Have a look at this enormous list of the technical changes contained in the update. These changes result in a more performant and clean library.
You might notice that there aren’t many new features in this release. This release is not something big from an end user’s perspective, but from a technology perspective, it is.
One of the major advantages of this release is the update to the newest version of the Angular framework, which is v12. Because of that, you get all the security and performance improvements along with new Angular features.
Since version 3.0, Spartacus has been extracting features to separate libraries in order to become more composable. In version 4.0, the checkout feature has undergone this process as well.
From a functional perspective, the new release adds a display of prices for attribute values to CPQ and a cloning option when restoring a saved cart. Additionally, it adds a new storefront theme called “Santorini.” I don’t think this new theme is particularly useful, but it’s good for visualizing the storefront theming feature introduced earlier.
How to migrate to Spartacus 4.0?
SAP Spartacus is said to be upgradable. Based on my experience it really is. Upgrade schematics provided by the core team really work well. However, as mentioned in the previous section, Spartacus 4.0 has a lot of technical changes, and there are few things you have to watch out for.
Spartacus 3.1 introduced the reference app structure. To be able to use schematics to update your project, you have to first migrate your project to the reference app structure manually. It’s not a big task, but you have to do it carefully. Follow the steps listed in the official documentation.
Since Spartacus 3.0, a lot of features were moved to separate packages and lazy loading of them was enabled. During migration, it’s tempting not to use the lazy loading capabilities and only change the import path. Unfortunately, I experienced some issues with this approach. Sometimes Spartacus packages don’t work as intended when eagerly loaded. This is clearly unexpected behavior, and I’ve already filed bug reports on these.
Is it worth it to get Spartacus 4.0?
Spartacus 4.0 seems to offer very few user-facing features, and the migration seems a little complicated. Because of this, you might get the idea that it’s not worth migrating. But, if you think about the upcoming minor versions, which will include a lot of new features, you should plan the migration right now.
Contact us if you have any issues with the migration. We can support you, and feedback on the migration process is always appreciated.