Skip to content

Commit

Permalink
Fix vite update breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpaquim committed Aug 8, 2024
1 parent 5cccf85 commit 26071f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const prefix = '/content/';
const suffix = '.md';
// vite does not support variables in glob imports, but the glob should match
// const pattern = `${prefix}*${suffix}`
const imports = import.meta.globEager('/content/*.md');
const importsRaw = import.meta.globEager('/content/*.md', { as: 'raw' });
const imports = import.meta.glob('/content/*.md', { eager: true });
const importsRaw = import.meta.glob('/content/*.md', { eager: true, query: '?raw' });

/** derive the file path from the corresponding slug, and the base folder prefix
* and extension suffix, redirecting '' -> index
Expand Down Expand Up @@ -59,7 +59,7 @@ export const pages = Object.entries(imports).map(([path, module], index) => {
const linkSlug = hrefToSlug(href);
backlinks[linkSlug] = backlinks[linkSlug]?.concat(slug) ?? [slug];
});
const md = importsRaw[path];
const md = importsRaw[path].default;
const fmEnd = md.lastIndexOf(fmMarker) + fmMarker.length;
const scriptEnd = md.lastIndexOf(scriptMarker) + scriptMarker.length;
// TODO: index html text elements only?
Expand Down

0 comments on commit 26071f3

Please sign in to comment.