I'm trying to share functions across multiple backgrounds scripts in a chrome-extension. This works easily / by design in general as long as you add the scripts to the manifest.json, then a function called from the background.js can call code in another script as long as that other script is loaded first.
HOWEVER, I've tried a few Chrome extension generator templates that have a compilation step with gulp or webpack. (e.g. This one: https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate)
But unfortunately function sharing breaks in the compiled background.js scripts.
I don't know what "magic" in the chrome-extension architecture is broken when compiled code is used.
Any advice/insights on what could be preventing function sharing appreciated. For details on the implementation e.g. webpack.config etc. please see the boilerplate as that's what I'm working with as well.