import method to other file without ES6 in firefox extension

I develop web extensions for the browser. I have a js file code from which is designed to create a specific ui on the site page, the problem here is that I do not want to duplicate this code in 2 different content_scripts for different pages of the site.

Since I want my application to work also for firefox, I cannot use the basic method import because it is not available in firefox on manifest_version 3.

What are the current workarounds to solve this problem? I currently have 1 working option such as creating a ui by calling code from background.js