14
Views
4
Comments
Solved
How to solve a JavaScript library conflict
Application Type
Reactive

I'm currently creating a widget for StreetSmart (Cyclomedia). However, when adding the script to the page, I get an error:

only one instance of babel-polyfill is allowed

This is probably caused by the fact that the page has loaded several other widgets of which one also instantiates babel-polyfill.

Since all JavaScript libraries that I use are either components straight from the Forge (CKEditor, React-FilePond, etc.) or have minified JS files (like the one I'm building now) I can't control how other libraries are loaded within the extensions.

Do you have any recommendation to solve such a situation?

mvp_badge
MVP
Solution

RequireScript unfortunately did not do the trick, since the script itself was not loaded already. It was just one component that was initialized twice.

But the good news is, I got it solved by adding a line of javascript before triggering RequireScript:

_babelPolyfill = false;
mvp_badge
MVP

Good you found a solution, maybe it is a good idea to mention to the component team(s) that their component is not easily combinable with other components or another application being build that uses babel-polyfill, would they have used RequireScript, you would not have this problem.

mvp_badge
MVP

Hi Remco,

Reading your question I understand this relates to RWA. If you select the application type when you create the question, this is more clear for all readers.

Regards,

Daniel

mvp_badge
MVP

You could try to use system client action requirescript, it ensures a script is not loaded if already loaded.

https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/System_Actions#RequireScript 


mvp_badge
MVP
Solution

RequireScript unfortunately did not do the trick, since the script itself was not loaded already. It was just one component that was initialized twice.

But the good news is, I got it solved by adding a line of javascript before triggering RequireScript:

_babelPolyfill = false;
mvp_badge
MVP

Good you found a solution, maybe it is a good idea to mention to the component team(s) that their component is not easily combinable with other components or another application being build that uses babel-polyfill, would they have used RequireScript, you would not have this problem.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.