Runtime execution errors and scope isolation issues when bundling custom JS utility in Liferay Client Extensions?

Hey everyone,
hoping to get some technical guidance from anyone who has worked with deploying custom JavaScript client extensions or dynamic script shims on Liferay DXP 7.4 / Liferay 2026 releases.

We are currently building a custom JS frontend client extension intended to inject external interactive utilities and handle execution hooks dynamically across portal pages. While the extension deploys cleanly via Liferay Workspace and registers in the OSGi bundle lifecycle, we hit a snag during browser runtime initialization. As soon as the SPA (Senna.js) page transition completes, the script throws an unhandled execution exception and loses its dynamic scope context.

I initially suspected an issue with how Senna.js re-evaluates global scripts on SPA navigation or a conflict with strict Content Security Policy (CSP) headers. I went through several generic troubleshooting logs here regarding app initialization failures and execution hook crashes, but applying those standard fixes hasn’t resolved how Liferay wraps global objects inside the page lifecycle.

Has anyone here run into similar script execution or lifecycle destruction errors when loading external utility packages as Liferay Client Extensions? Do you typically configure custom onload hooks or disable SPA re-evaluation for specific third-party frontend modules to prevent these runtime crashes?

Appreciate any advice or configuration snippets from anyone who has run into this!