diff --git a/.changeset/moody-balloons-cheat.md b/.changeset/moody-balloons-cheat.md new file mode 100644 index 00000000..f94d16db --- /dev/null +++ b/.changeset/moody-balloons-cheat.md @@ -0,0 +1,5 @@ +--- +'mdsvex': patch +--- + +Replace hyphen in YAML frontmatter with underscore to prevent issues when building diff --git a/packages/mdsvex/src/transformers/index.ts b/packages/mdsvex/src/transformers/index.ts index 429938ea..8ca31803 100644 --- a/packages/mdsvex/src/transformers/index.ts +++ b/packages/mdsvex/src/transformers/index.ts @@ -332,7 +332,9 @@ export function transform_hast({ const fm = metadata && `export const metadata = ${stringified};${newline}` + - `\tconst { ${Object.keys(metadata).join(', ')} } = metadata;`; + `\tconst { ${Object.keys(metadata) + .join(', ') + .replace(/-/g, '_')} } = metadata;`; const frontmatter_layout = metadata && (metadata.layout as string | undefined | false);