By using a combination of NodeJS and various build tools, we can easily build complex ModPE mods. This allows us to import third-party modules and structure multiple files in a maintainable way.
Possibly the greatest benefit of this is the ability to
require modules. Developers can now use libraries in the ModPE packages, such as the inform library.
const inform = require('inform');
Obviously, these are just Node modules, however the majority of NPM packages wouldn’t behave as expected in the ModPE environment.
This whole setup, with Grunt, is available as a skeleton here.
One downside of Browserify in this usage is that inability for the ModPE engine to call hooks, such as
This is easily overcome by utilising the ‘modpe-globe’ module, as shown in the demo code above. This simply provides an entrance to the world outside of the Browserify realm.
Moving from unweildy & lengthy ModPE scripts to cleaner & organised Node projects is now the smart way to go, especially, when paired with any build tool. Whether it’s feasible for the average ModPE developer is the next question.