feat: log loaded config and add catch

This commit is contained in:
Ayo Ayco 2024-12-31 01:35:35 +01:00
parent 4640b6e5cf
commit 063bc0567b

View file

@ -22,14 +22,17 @@ import { eventHandler } from 'h3'
export function useMcFlyRoute({ storage }) { export function useMcFlyRoute({ storage }) {
return eventHandler(async (event) => { return eventHandler(async (event) => {
const { path } = event const { path } = event
const { config } = await loadConfig({ const loadedConfig = await loadConfig({
name: 'mcfly', name: 'mcfly',
configFile: 'mcfly.config', configFile: 'mcfly.config',
}) })
const config = loadConfig.config ?? {
components: 'js',
}
const { components: componentType } = config const { components: componentType } = config
let html = await getHtml(path, storage) let html = await getHtml(path, storage)
console.log('[INFO]: Mcfly Config', config) console.log('[INFO]: Mcfly Config', loadedConfig)
if (html) { if (html) {
const transforms = [evaluateServerScript, deleteServerScripts] const transforms = [evaluateServerScript, deleteServerScripts]