This is almost the same question asked in How to reference a JavaScript file in Lib from an HTML file in Data? so I just rephrase the answer I gave there.
Put the file in the /lib/ folder, then get the resouce url with:
var url=require("sdk/self").data.url("../lib/shared-file.js");
Once you have this URL, you can attach it to a tab or popup menu using the contentScriptFile parameter.
Note. You will need to check what environment you are currently in to determine if you need to add links to the exports object to make them accessible from the addon.
if(typeof(exports)!="undefined"){ exports.something=function(){...}; }
source share