Converting a Firefox extension from cfx to jpm

Since working on Mediathread's Chrome extension, and soon a Safari extension, I'm learning all about the extension-building tools provided for different web browsers. Last night I picked up on my effort to convert LibreJS from Mozilla's older Add-on SDK to their new but not quite stable system, a node.js program called jpm, which replaced the python-based Add-on SDK (aka cfx) at the beginning of this year. Mozilla's extension building tools can be a annoying to work with. Mozilla also has automated and manual extension approval procedures that you don't run into when submitting extensions to the Chrome Web Store. All your extension code is run through an automated validator that looks at all the dependencies in your extension's node_modules/, which can cause annoying issues:

See the jpm branch on LibreJS to get the gist of what I had to change. You have to change all the absolute paths within your code to relative paths, for example:

-const nonTrivialCheckModule =
+const nonTrivialCheckModule =