简体   繁体   中英

How to add a file other than index.js to a Firefox add-on using jpm

I am building a Firefox add-on and like to include code that is used in the index.js, as well as in the worker script. Instead of copying the function, I would like to add it in a file next to the index.js if possible.

for addon modules you use require("./relative/path.js") , for the worker you specify it through the contentScriptFile parameter. You will have to feature-detect whether CommonJS features (require/exports) are available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM