diff --git a/package-lock.json b/package-lock.json index fcbbe4d..a9582a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/vite", - "version": "5.10.0", + "version": "5.11.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/vite", - "version": "5.10.0", + "version": "5.11.0", "license": "MIT", "dependencies": { "@fastify/middie": "^9.0.2", diff --git a/package.json b/package.json index fedaf12..68b706f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/vite", - "version": "5.10.0", + "version": "5.11.0", "description": "Vite plugin for Athenna Framework.", "license": "MIT", "author": "João Lenon ", diff --git a/src/renders/React.ts b/src/renders/React.ts index 4efeedd..3181b9b 100644 --- a/src/renders/React.ts +++ b/src/renders/React.ts @@ -7,9 +7,27 @@ * file that was distributed with this source code. */ +import { Config } from '@athenna/config' import type { Vite } from '#src/vite/Vite' export class React { + /** + * The same as using `React.loadComponent()` method: + * + * @example + * ```ts + * // 'src/resources/app/app.tsx' + * const entrypoint = Config.get('http.vite.ssrEntrypoint') + * + * const { createApp } = await React.loadComponent(entrypoint) + * ``` + */ + public static async loadEntrypoint() { + const entrypoint = Config.get('http.vite.ssrEntrypoint') + + return React.loadComponent(entrypoint) + } + /** * Automatically compile a React component using Vite * dev server and import it. In production the server