MemberJunction / MemberJunction/MJ

mj codegen manifest --lazy-config collapses per-module chunk loaders into one

Open
#3,645 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TSQL
Stars
29
Forks
6
Avg merge
2d 1h
Merged PRs (30d)
323

Description

Running `npm run mj:manifest:explorer` on `next` rewrites `packages/Angular/Explorer/explorer-core/src/generated/lazy-feature-config.ts` in a way the file's own header explicitly forbids.

**Committed shape** — one loader per submodule, each with a distinct `chunkId`:

```ts
// --- @memberjunction/ng-dashboards → ./actions-dashboards.module (6 entries) ---
const loadNgDashboardsActionsDashboardsModule = {
chunkId: '@memberjunction/ng-dashboards/actions-dashboards.module',
load: () => import('@memberjunction/ng-dashboards/actions-dashboards.module').then(() => {})
};
// …~20 of these
```

**Regenerated shape** — all of them collapsed to a single `loadNgDashboards`, net −225/+115 lines.

The header warns about precisely this:

> Every entry carries an explicit `chunkId` — the dynamic import specifier — because many compound keys share one chunk and the registry must be able to tell those chunks apart. Do NOT collapse these into a shared helper that returns a closure…

**Impact if committed:** every Explorer dashboard lazy-loads the whole `ng-dashboards` package as one chunk instead of per-feature chunks — a bundle regression across the entire app, landing inside a generated file nobody re-reads on review.

**How it surfaced:** adding the Workflows app in #3456's Phase 5a needed two new entries. The generator produced them correctly *and* rewrote everything else. I discarded the regeneration and hand-added the two entries in the existing style (see the Phase 5a PR), so `next` is unaffected — but the generator will do this again to whoever runs it next.

**Guess at the cause** (unverified): the generator likely enumerates chunks from built `dist`/package `exports` and, not finding the per-submodule subpaths it expects, falls back to grouping by package. Worth checking whether it needs a built workspace, or whether the subpath-export detection regressed.

Not fixing it here — it is orthogonal to the workflow program, and the failure mode is quiet enough to deserve its own change.

Contributor guide

Open the contributing guide

Research direction

Start with `npm run mj:manifest:explorer` and inspect `packages/Angular/Explorer/explorer-core/src/generated/lazy-feature-config.ts`, including its header. Trace how the generator discovers chunks from built `dist` and package `exports`, especially per-submodule subpaths. Done means regeneration preserves one loader and distinct `chunkId` per submodule instead of collapsing the package into one chunk.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.