Skip to content

Commit

Permalink
Merge pull request #11 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat(react): add loadEntrypoint method
  • Loading branch information
jlenon7 authored Jan 16, 2025
2 parents 4638183 + 9181384 commit c3f7bcb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
18 changes: 18 additions & 0 deletions src/renders/React.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T = any>() {
const entrypoint = Config.get('http.vite.ssrEntrypoint')

return React.loadComponent<T>(entrypoint)
}

/**
* Automatically compile a React component using Vite
* dev server and import it. In production the server
Expand Down

0 comments on commit c3f7bcb

Please sign in to comment.