Alexander-Schranz
Alexander Schranz
Core Developer – Sulu GmbH
Core developer and support king. So dedicated to his work that we couldn't find a hobby to mention.
@alex_s_

Sulu Release 2.4.8 & 2.5.4

We published a small bugfix release for Sulu 2.4 and Sulu 2.5. The versions 2.4.8 and 2.5.4 fix a problem with custom JS Admin builds.

Fix problems with the NPM build

Sulu uses webpack 4 to transpile and bundle the administration interface JavaScript application. At the moment, webpack 4 uses an outdated version of the terser parser. This parser unfortunately does not support some modern JavaScript syntax features - therefore it fails if Babel does not transpile the modern syntax before it is parsed by Webpack. Furthermore, we have configured Babel to use a dynamic browserlist (via the caniuse-lite package) for determining which syntax must be transpiled. Recently, this package was updated and our dynamic browserlist caused Babel to be unable to transpile the optional chaining syntax. Unfortunately, the terser parser does not support this syntax and consequently the build of the Sulu administration interface application failed. 

We fixed the issue by explicitly adding the required Babel plugin to our Babel configuration, and we decided to use a static browserlist to prevent similar problems in the future. I want to thank @scasei for reporting this issue and contributing a pull request to fix it.

If you cannot update your project to the latest version and depend on a custom JavaScript build, you can fix the problem in your project with the following changes:

diff --git a/assets/admin/babel.config.json b/assets/admin/babel.config.json
index f73bc7b08d..f22d5f2bb4 100644
--- a/assets/admin/babel.config.json
+++ b/assets/admin/babel.config.json
@@ -7,7 +7,8 @@
         ["@babel/plugin-proposal-decorators", {"legacy": true}],
         "@babel/plugin-transform-flow-strip-types",
         "@babel/plugin-proposal-nullish-coalescing-operator",
-        "@babel/plugin-proposal-class-properties"
+        "@babel/plugin-proposal-class-properties",
+        "@babel/plugin-proposal-optional-chaining"
     ],
     "assumptions": {
         "setPublicClassFields": true
diff --git a/assets/admin/package.json b/assets/admin/package.json
index 72b7d8c544..aa237ce1ce 100644
--- a/assets/admin/package.json
+++ b/assets/admin/package.json
@@ -34,6 +34,7 @@
         "@babel/plugin-proposal-class-properties": "^7.16.5",
         "@babel/plugin-proposal-decorators": "^7.4.4",
         "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
+        "@babel/plugin-proposal-optional-chaining": "^7.18.9",
         "@babel/plugin-transform-flow-strip-types": "^7.4.4",
         "@babel/preset-env": "^7.5.5",
         "@babel/preset-react": "^7.0.0",

Accessibility improvements

Thanks to our partner datenwerk, we were able to fix an accessibility issue with the sulu-link tag. Previously, the sulu-link tag automatically added the page title as fallback for the title attribute of a rendered link. This impacted accessibility because title attributes were being read out twice by screen readers if the content of the link matched the title attribute. We decided to remove this fallback - the sulu-link tag no longer automatically sets a title attribute.

Read more about working with the title attribute in this post from 24 Accessibility.

What is coming next?

We have already planned a new feature for Sulu 2.6 - the next minor release of Sulu - which I think you will like a lot. More information about this will be published in an upcoming blog post.

As always, we are happy to hear your feedback about newly released features and bug fixes. Feel free to create an issue or a discussion on GitHub for bugs and feature requests. You can also contact us via Slack or our website anytime.