'Why does loading an extrnal JS file break the page's styling?

I have a situation where an external js file is loaded on the page depending on a query parameter. The file contains UI components and their styles. When the file loads, it breaks the page's styling.

What I am struggling to understand is why the page elements have the same css classes but appear different.

Without the JS file

enter image description here

With the JS file

enter image description here

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source