Dash Compiler

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

A fast, platform-agnostic compiler for Minecraft Add-Ons, replacing bridge.'s old internal compiler since v2.2.0. Current stable version is 0.10.10, with regular releases. It supports standalone builds for Deno and ships TypeScript types. Unlike other tools, it is designed specifically for Minecraft Add-On compilation, focusing on speed and reliability across platforms.

error Module not found: Can't resolve 'dash-compiler'
cause Using require() instead of import, or missing package installation.
fix
npm install dash-compiler and use import { compile } from 'dash-compiler'
error TypeError: compile is not a function
cause Destructuring the default export incorrectly.
fix
Use import dashCompiler from 'dash-compiler' and call dashCompiler.compile()
error error TS2307: Cannot find module 'dash-compiler' or its corresponding type declarations.
cause TypeScript resolution issue due to ESM module configuration.
fix
Set 'moduleResolution' to 'node16' in tsconfig.json and ensure 'types' field includes 'node'.
error Error: Cannot find module './dist/compile' imported from 'dash-compiler'
cause Using an outdated version or corrupt installation.
fix
Reinstall package: rm -rf node_modules/dash-compiler && npm install
breaking BREAKING CHANGE: As of v0.10.0, the compile function no longer accepts a callback; it returns a Promise.
fix Use async/await or .then() instead of a callback.
deprecated Deprecated: The 'verbose' option has been removed in v0.9.0. Use 'logLevel' instead.
fix Replace 'verbose: true' with 'logLevel: 'debug'.
gotcha The package is ESM-only. CommonJS require() will throw a Module not found error.
fix Use import syntax or ensure your project is configured for ESM.
gotcha When using TypeScript, you must set 'moduleResolution' to 'node16' or 'nodenext' in tsconfig.json to resolve types correctly.
fix Update tsconfig.json: { compilerOptions: { moduleResolution: 'node16' } }
breaking BREAKING CHANGE: The output format changed in v0.8.0 from JSON to a custom binary format for performance.
fix Parse output with the provided 'parseOutput' utility from 'dash-compiler/utils'.
npm install dash-compiler
yarn add dash-compiler
pnpm add dash-compiler

Demonstrates basic usage of the compile function with options object and async/await.

import { compile } from 'dash-compiler';

async function main() {
  const options = {
    input: './src',
    output: './dist',
    minify: true,
    watch: false,
  };
  const result = await compile(options);
  console.log('Compilation successful:', result.files);
}

main().catch(console.error);