Description
When using @lessjs/content for blog posts, getPosts() returns empty data during SSG rendering, causing all blog-dependent pages to crash:
<!-- LessJS ERROR: <home-page> render() threw: Cannot read properties of undefined (reading 'tags') -->
<!-- LessJS ERROR: <blog-index-page> render() threw: Cannot read properties of undefined (reading 'title') -->
Root Cause
In build-ssg.ts, initBlogData() is called (line ~361-374) inside the dynamic routes block, before toSSG(). However, when using resolveAlias to point @lessjs/content to a local source, the module loaded via ssrLoadModule('@lessjs/content') may resolve to a different instance than the one imported by route modules. The initialized data store is not shared across module instances.
In custom SSG scripts using esbuild pre-compilation, the bundled route modules reference a different getPosts() than the one initBlogData() initializes — same function name, different closure.
Severity
P1 — All blog projects using @lessjs/content fail SSG rendering. Related to Issue 2 (module instance duplication).
Description
When using
@lessjs/contentfor blog posts,getPosts()returns empty data during SSG rendering, causing all blog-dependent pages to crash:Root Cause
In
build-ssg.ts,initBlogData()is called (line ~361-374) inside the dynamic routes block, beforetoSSG(). However, when usingresolveAliasto point@lessjs/contentto a local source, the module loaded viassrLoadModule('@lessjs/content')may resolve to a different instance than the one imported by route modules. The initialized data store is not shared across module instances.In custom SSG scripts using esbuild pre-compilation, the bundled route modules reference a different
getPosts()than the oneinitBlogData()initializes — same function name, different closure.Severity
P1 — All blog projects using
@lessjs/contentfail SSG rendering. Related to Issue 2 (module instance duplication).