Skip to main content

Coralite v0.24.0: Build Modes, Client/Server Separation, and Plugin Enhancements #

Thomas David -

Welcome to Coralite v0.24.0! This update is all about bringing structure, clarity, and robust debugging tools to your components and builds.

TL;DR of what's new:

Development & Production Build Modes #

With v0.24.0, we have introduced explicit Development and Production build modes. This foundational change allows Coralite to optimize its internal behavior based on what you are trying to achieve.

In Development mode, Coralite prioritizes debugging. It utilizes SourceTextModule for server-side evaluation and automatically injects inline sourcemaps into all of your client-side component scripts. We also resolve bare module specifiers dynamically using createRequire relative to your importing component.

In Production mode, Coralite strips out the debugging overhead and relies on highly optimized esbuild transformations to compile your server-side scripts for maximum performance.

Client/Server Separation in defineComponent #

We've completely restructured the defineComponent API to enforce a strict and clear separation between server-side Server-Side Rendering (SSR) logic and client-side browser execution.

Client-side configurations—including imports, SSR data preparation (setup), and browser execution logic (script)—must now be nested within a dedicated client object. This structural change prevents server-only logic from accidentally leaking into your client bundles and provides a much better mental model for component authoring.

javascript
Code copied!
  defineComponent({
    client: {
      imports: [{ specifier: 'my-package' }],
      setup(props) {
        // Runs on the server during SSR
        return { serverTime: Date.now() }
      },
      script({ values }) {
        // Runs on the client
        console.log("Server time was:", values.serverTime)
      }
    }
  })

Sourcemap Support for Easier Debugging #

As part of the new Development mode, Coralite now automatically generates and maps inline sourcemaps for the code you write inside your client.script functions. Say goodbye to struggling with minified or obscured errors in the browser console. Stack traces will now point directly back to the original source lines in your component templates!

Plugin Enhancements & The onBuildComplete Hook #

We continue to expand the power available to plugin authors:

How to Upgrade #

You can upgrade your projects today by updating your dependencies:

bash
Code copied!
  npm install coralite@latest

Happy building!

Related posts

More blog posts

Start Building with Coralite!

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