Skip to main content

Configuration Reference

Coralite is configured using a coralite.config.js file in the root of your project. This file exports a configuration object that defines input paths, output directories, plugins, and build options.

If you prefer TypeScript or type hinting, you can use the defineConfig helper from coralite-scripts.

javascript
Code copied!
  // coralite.config.js
  import { defineConfig } from 'coralite-scripts';
  import myPlugin from './plugins/my-plugin.js';
  
  export default defineConfig({
    components: 'src/components',
    pages: 'src/pages',
    output: 'dist',
    plugins: [myPlugin],
    onError: ({ level, message, error }) => {
      if (level === 'ERR') {
        console.error(`[FATAL] ${message}`);
        if (error) console.error(error.stack);
      } else {
        console.warn(`[${level}] ${message}`);
      }
    }
  });

Configuration Options #

The CoraliteConfig object accepts the following properties:

Property Type Default Description
components string - Path to the directory containing Coralite components.
pages string - Path to the directory containing pages.
output string - Path to the output directory.
plugins CoralitePluginInstance[] [] Array of plugin instances.
baseURL string '/' Base URL for asset paths.
onError CoraliteOnError Default handler Callback for handling errors and warnings. The Coralite instance securely wraps this callback inside its own internal handleError function. By default, it throws for 'ERR' and logs to console for others.
mode 'production' | 'development' 'production' Build mode.

Assets Plugin (coralite-scripts) #

The assets property (processed by staticAssetPlugin) expects an array of objects. These objects must define a dest property. To determine the source, you must define either pkg (and optionally path) or an explicit src path to bypass standard package resolution.

Environment Considerations #

When running Coralite using the coralite-scripts development mode (e.g., npm run dev or mode === 'dev'), the output directory is automatically overridden to a temporary .coralite/build folder to isolate build artifacts from production outputs. This directory is automatically cleaned up on server startup and graceful exit.

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!