ModPE Compiler

raw JSON →
0.1.0 verified Fri May 01 auth: no javascript

A build tool that integrates linting (ESLint), transpilation (Babel), and minification (UglifyJS) for ModPE scripts used in the BlockLauncher Minecraft modding platform. Version 0.1.0 is the current stable release, likely with low release cadence. It differs from general transpilers by targeting the ModPE runtime environment specifically, providing a single-command pipeline for legacy ModPE JavaScript development.

error Error: Cannot find module 'uglify-js'
cause Missing optional dependency; UglifyJS is expected but not a direct dependency.
fix
Install manually: npm install uglify-js
error TypeError: compiler.run is not a function
cause Using default import syntax with ES import; ModPECompiler is the default, but run is not a static method.
fix
Instantiate first: new ModPECompiler().run()
error Error: ENOENT: no such file or directory, open '...'
cause File path provided does not exist.
fix
Verify the file path passed to the constructor.
gotcha ESM import syntax is not supported natively; only CommonJS require works.
fix Use const ModPECompiler = require('modpe-compiler');
gotcha Input file must be valid JavaScript; no error reporting for missing files beyond generic message.
fix Check file path exists before calling constructor.
deprecated ESLint, Babel, and UglifyJS are outdated dependencies; may have security vulnerabilities.
fix Use alternative tools that are actively maintained.
npm install modpe-compiler
yarn add modpe-compiler
pnpm add modpe-compiler

Shows how to instantiate ModPECompiler, run lint/transpile/minify pipeline, and save output.

const ModPECompiler = require('modpe-compiler');
let compiler = new ModPECompiler('./my_script.js');
try {
  compiler.run();
  compiler.saveAsFile();
  console.log('Compiled successfully');
} catch (err) {
  console.error('Compilation failed:', err);
}