Hi everyone,
My name is Jennifer, product manager on the platform team, and I’m sharing an important announcement for certain plugin authors. In order to improve Bubble apps’ pageload speed, Bubble is changing most of our javascript script tag types to “module.” This will greatly benefit everyone building on Bubble, but plugins that have certain HTML headers may break.
If you have an existing affected plugin, you have been contacted by email by @vivienne. This guide serves as a public reference for all plugin authors to the information included in that email.
These changes will take effect by July 1, 2024.
Users whose apps leverage these plugins will be notified on July 8, 2024 that their apps will be affected.
Things affected plugin authors need to do
Change script types to ”module” in your headers
If your headers contain any javascript that expects Bubble code to have finished initializing, then you will need to set the type parameter of those script tags to “module.”
For Example:
<script> // javascript here... </script>
Should now be:
<script type="module"> // javascript here... </script>
Stop using document.write and use $(‘head’).append instead
If header script code includes a call to document.write, these scripts will break after converting the tag to type=“module” due to the deferred time at which the code is executed. To fix this, change these document.write calls to use the function $(‘head’).append instead.
For Example:
<script type="module"> document.write('<link rel="preload" href="www.example.com">') // ERROR </script>
Should now be:
<script type="module"> $('head').append('<link rel="preload" href="www.example.com">') </script>
Importmap scripts will no longer work
If your header code includes a script of type “importmap,” then this script will no longer function. Import statements will need to use the literal path when loading modules instead of using importmap scripts to remap the paths. This effect is because most browsers disallow multiple importmap scripts.
Let us know if you have any questions!
Jennifer