Über Open CoDE Software Wiki Diskussionen GitLab

Skip to content

Wrap resulting JS file in IIFE on build

Goldland Media requested to merge feature/wrap-build-in-iife into main

We decided to wrap the resulting JS file in IIFE because from a certain commit (!26 (merged)) search-ui started breaking the content-ui application.

It's happening for logged in users, on pages with the search-ui integration (mainly homepage and /suche). The reason is that content-ui's JS scripts and search-ui's JS scripts contain the same global variable _. In content-ui it's used by Drupal's core modules, that are only enabled for logged in users - this is why there's no error for anonymous users. Currently we can't disable/deactivate this script and module from the content-ui side.

Wrapping the search-ui JS code in IIFE solves this problem.

Merge request reports