Installation and Configuration

Installation

To make the ModularMC filter available in your Regolith project, run the following command:

regolith install modular_mc

To enable the filter, add the following configuration to the filters list in the config.json file of your Regolith project. Adjust the settings properties as needed (explained in the next section):

{
    "filter": "modular_mc",
    "settings": {
        "esbuild": {
            "buildPath": ".modular_mc/main.js",
            "settings": {
                "sourcemap": true
            }
        }
    }
}

Configuration Settings

Configuration settings should be placed in the settings property of the filter in the config.json file of your Regolith project. All settings are optional and have default behavior if not set.

esbuild: object

The esbuild property configures TypeScript and JavaScript compilation. It has two sub-properties:

esbuild.settings: object

Contains compilation options for TypeScript/JavaScript processing. Note that ModularMC only supports specific settings, not arbitrary Esbuild options. Supported settings:

  • sourcemap: Whether to generate source maps for debugging (true/false, default: false)

  • minify: Whether to minify the output (true/false, default: false)

  • external: Array of packages to mark as external (default: [“@minecraft/server”])

  • outfile: Output file path relative to filter working directory (default: “BP/scripts/main.js”)

  • dropLabels: Array of labels to drop from the output. For example, you can label your debug-only code with DEBUG: and then drop it from the production build by setting this to ["DEBUG"]. (default: [])

Other esbuild settings like target (es2020), format (esm), and bundle (true) are hardcoded by ModularMC for compatibility.

esbuild.buildPath: string

The buildPath specifies where compiled scripts should be output, relative to the project root. This is useful for development workflows where you want scripts compiled to a specific location for easier debugging.

For example, setting "buildPath": ".modular_mc/main.js" will compile scripts to that location for development. It will also export them to the final behavior pack to be used by Minecraft. This is useful for debugging with the Minecraft Bedrock Debugger.