javascript - Import shared code between Firefox addon and Chrome addon into Firefox -
i developing firefox addon has chrome counterpart. eliminate code duplication there javascript libraries share in common. libraries not written commonjs design firefox jetpack modules expect. there way import , use shared javascript firefox modules?
preferably shared code can sit in directory in root directory, shared library has own rich directory structure , don't want stuff data or lib directory.
it's easy make js file loadable via commonjs, need add functions needed properties exports object, like:
function foo() {} function bar() {} if (exports !== void 0) { exports.foo = foo; exports.bar = bar; }
Comments
Post a Comment