Coralite v0.29.3 Released
Coralite v0.29.3 has been released, introducing key fixes and performance enhancements to the framework's script manager, dependency resolution, and asset build pipeline. This version focuses on bringing native browser module resolution to esbuild, enforcing deterministic asset hashing, implementing an in-memory page resolution cache to speed up rebuilds, and adopting a dynamic MutationObserver-based chunk loader.
Native Module Resolution and Polyfills #
To prevent ENOENT filesystem crashes and backend-related ReferenceError occurrences, the import resolver now defers to esbuild's native resolution strategy rather than forcing CommonJS files via Node's require.resolve(). This allows esbuild to favor browser-compatible entries in dependency package.json manifests, resolving compatibility crashes with packages like matrix-sdk-crypto-wasm.
Additionally, the deprecated esbuild-plugin-polyfill-node library has been replaced with the actively maintained esbuild-plugins-node-modules-polyfill in the ScriptManager. Local dependencies are also resolved first through the consumer's local packages before falling back to external CDN URLs, and Node.js built-ins are marked as external to prevent build-time crashes.
Deterministic Hashing and Deduplicated Build Pipelines #
To improve build output consistency and optimize caching, the ScriptManager now alphabetically sorts processedComponentKeys during compilation. This ensures that assets mapping to the same group of components consistently generate the same output block hash.
A new local in-memory page resolution cache checks DOM element trees across build cycles. If a page maps to a component dependency list that has already been processed, the pipeline bypasses the execution of compileAllInstances, reducing CPU overhead and build times. Furthermore, CLI modes now map directly to environmental variables, enabling production-only minification, tree-shaking, and external sourcemaps automatically.
Absolute Base URLs and Asset Separation #
To ensure asset paths resolve correctly on deeply nested pages (such as /docs/guide/), a baseURL configuration option has been introduced. Dynamically generated orchestrator script tags and imports now resolve as absolute paths using this base URL prefix.
As part of this configuration change, static asset output directories have been organized. CSS is now built to .coralite/assets/css/ and JavaScript chunks to .coralite/assets/js/, keeping compiled static files isolated and easy to manage.
// coralite.config.js
export default {
baseURL: '/docs/',
};
We have also resolved asset discovery issues by updating the static asset plugin to look up packages relative to the current working directory (process.cwd()) instead of the module's file location, fixing module resolution errors for local and linked packages.
Dynamic Component Mount Orchestration #
Within the browser orchestrator, the legacy query checking mechanism has been replaced with a dynamic MutationObserver on document.body. This allows the client-side runtime to monitor the DOM and lazily load required JavaScript chunks asynchronously as custom component elements (e.g. dynamically created elements) are mounted into the document.
Breaking Changes #
- Reorganized Asset Subdirectories: Compiled assets are now structured within
.coralite/assets/css/and.coralite/assets/js/. If you run custom scripts or servers targeting the old output paths, these must be updated to refer to the new directories. - Absolute URL Paths: Orchestrator script tags and dynamic bundle imports now resolve as absolute paths utilizing the configured
baseURL(defaulting to/).
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.29.3
npm install coralite-scripts@0.29.3
