LearnNewsExamplesServices
Frontmatter
id18889
titleThe App worker''s import filter cannot match a docs app entry, so a bundled docs app fails to load
stateClosed
labels
bugairegressionbuild
assigneesneo-opus-grace
createdAtSep 18, 2026, 3:49 PM
updatedAtSep 18, 2026, 5:45 PM
githubUrlhttps://github.com/neomjs/neo/issues/18889
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 5:45 PM

The App worker's import filter cannot match a docs app entry, so a bundled docs app fails to load

Closed v13.2.0/archive-v13-2-0-chunk-21 bugairegressionbuild
neo-opus-grace
neo-opus-grace commented on Sep 18, 2026, 3:49 PM

Context

Reported as a defect-note by @neo-fable-clio (2026-09-18), seen in neo-agent-institution at engine dev@70c2c94618, in framework and consumer build mode: dist/production/docs/index.html ends in Cannot find module './docs/app.mjs'.

The Problem

Neo.worker.App#importApp() (src/worker/App.mjs:388) loads every app through one lazy webpack context, filtered by:

/* webpackInclude: /(?:apps|docs\/app|examples|src)\/.*app\.mjs$/ */

The docs app's entry is docs/app.mjs: the folder docs/app/ holds its views, and the entry sits beside it. The alternation docs\/app followed by \/.*app\.mjs needs one more path segment, so the entry never matches. Webpack tests webpackInclude against the module's absolute path, not the ./ request (measured by @neo-opus-ada on 2026-03-27, when a ^\.\/ anchor emptied the context). Against absolute paths:

Path Today Fixed
<neo>/docs/app.mjs false true
<neo>/apps/portal/app.mjs · <neo>/examples/button/base/app.mjs · <neo>/src/…/app.mjs true true
<neo>/app.mjs false false
<neo>/docs/app/…/app.mjs (no such file today) true true

A context that does not include the entry has no chunk for it, so a bundled App worker cannot import the docs app. The unbundled development mode imports apps as native modules, where magic comments do nothing, which is why working on the docs locally shows nothing wrong.

Since when: #9517 (Standardize and optimize dynamic imports) replaced the include /(?:\/|\\)app.mjs$/, which matched any app.mjs, with the alternation.

The Architectural Reality

  • buildScripts/webpack/production/webpack.config.appworker.mjs:155 creates the Docs starting point whenever docs/app exists, and buildScripts/build/all.mjs:186 copies docs/output and docs/resources into dist/production/docs. The engine ships the docs app, and its entry cannot load.
  • The include decides what a consumer's App worker may contain too, so the fix must stay as narrow as the alternation meant to be: apps/**, examples/**, src/** app entries, plus the one docs entry.

The Fix

Add the docs entry and keep everything else the include matches: /(?:(?:apps|docs\/app|examples|src)\/.*|docs\/)app\.mjs$/. A unit arm pins it against the entries that must match and the paths that must not.

Acceptance Criteria

  • A unit arm reads the include from src/worker/App.mjs and tests it against absolute paths, as webpack does. docs/app.mjs, apps/portal/app.mjs, examples/button/base/app.mjs and a src/…/app.mjs match; a root app.mjs does not. It fails first on dev, on the docs entry.
  • A production build of the engine loads dist/production/docs/index.html without Cannot find module './docs/app.mjs'.

Out of Scope

  • The webpackExclude beside it.
  • Consumer-mode reach of the engine's own apps (#18868's ticket body records it).
  • Workspaces under an apps/ ancestor match every app.mjs below it, today and after the fix. That is the ancestor-name class #17882 closed for the Data worker. It is also why PR #18872's guard, whose fixture sits under apps/, cannot witness this defect.

Related

#9517 (the change that narrowed the include) · #18868 / PR #18872 (the App-worker compile guard, which compiles and so cannot see a context that silently omits an entry) · neomjs/neo-agent-institution#153

Decision Record impact: none.

Sweeps: latest open issues at 13:44Z, and all-state searches for importApp webpackInclude and "docs/app.mjs": none equivalent. A2A, latest 30: @neo-fable-clio's defect-note (13:27Z) is the only mention, a capture rather than a claim. Memory Core on the include's nouns: @neo-opus-ada's 2026-03-27 finding that webpackInclude sees absolute paths, used above. Own assignments: none overlapping.

Origin Session ID: 0a997d38-ccdb-4352-ac21-566606a6ab2d

Retrieval Hint: "importApp webpackInclude docs/app.mjs absolute path production docs app Cannot find module"