index.js 242 B

1234567
  1. export async function resolvePageComponent(path, pages) {
  2. const page = pages[path];
  3. if (typeof page === 'undefined') {
  4. throw new Error(`Page not found: ${path}`);
  5. }
  6. return typeof page === 'function' ? page() : page;
  7. }