Plugin authors: Updates required to HTML headers, July 1, 2024

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

1 Like

I’m all in!

:smiley:

TBH I think more of best practice guidance on how to not make “bad” plugins is a good thing.

3 Likes

any plan/advice on giving plugin authors the ability to test this change and see if everything works?

Does this also affect custom code on our pages where I use html elements?

1 Like

Is this only for Shared Headers? Does this also affect Plugin Element Headers?

A developer can test if their plugin will work in module mode by adding the query parameter load_lean_page=true to the URL of a page for any bubble app . For example, Bubble: The full-stack no-code app builder loads the bubble homepage in module-based mode

EDIT: This parameter will probably go away when module-mode becomes the default.

2 Likes

This affects both shared and element headers.

1 Like

@jennifer.javier would really appreciate an answer here. We have a lot of custom html and javascript on a page that started experiencing weird front-end behavior a few weeks ago that we cannot solve. We did not change anything so this could be it. Can you please expand on this and advise if non plugin code on the page is affected?