mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
fix createApp() fn doesn't require config, fix admin controller main entry
This commit is contained in:
@@ -14,7 +14,7 @@ const htmlBkndContextReplace = "<!-- BKND_CONTEXT -->";
|
||||
export type AdminControllerOptions = {
|
||||
basepath?: string;
|
||||
html?: string;
|
||||
forceDev?: boolean;
|
||||
forceDev?: boolean | { mainPath: string };
|
||||
};
|
||||
|
||||
export class AdminController implements ClassController {
|
||||
@@ -108,7 +108,10 @@ export class AdminController implements ClassController {
|
||||
|
||||
if (this.options.html) {
|
||||
if (this.options.html.includes(htmlBkndContextReplace)) {
|
||||
return this.options.html.replace(htmlBkndContextReplace, bknd_context);
|
||||
return this.options.html.replace(
|
||||
htmlBkndContextReplace,
|
||||
"<script>" + bknd_context + "</script>"
|
||||
);
|
||||
}
|
||||
|
||||
console.warn(
|
||||
@@ -119,6 +122,10 @@ export class AdminController implements ClassController {
|
||||
|
||||
const configs = this.app.modules.configs();
|
||||
const isProd = !isDebug() && !this.options.forceDev;
|
||||
const mainPath =
|
||||
typeof this.options.forceDev === "object" && "mainPath" in this.options.forceDev
|
||||
? this.options.forceDev.mainPath
|
||||
: "/src/ui/main.tsx";
|
||||
|
||||
const assets = {
|
||||
js: "main.js",
|
||||
@@ -172,13 +179,14 @@ export class AdminController implements ClassController {
|
||||
)}
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" />
|
||||
<div id="app" />
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: bknd_context
|
||||
}}
|
||||
/>
|
||||
{!isProd && <script type="module" src="/src/ui/main.tsx" />}
|
||||
{!isProd && <script type="module" src={mainPath} />}
|
||||
</body>
|
||||
</html>
|
||||
</Fragment>
|
||||
|
||||
Reference in New Issue
Block a user