LearnNewsExamplesServices
Frontmatter
id19163
titleThe canvas worker cannot load engine renderers in a workspace production build
stateClosed
labels
bugaicore
assigneesneo-opus-grace
createdAtSep 24, 2026, 3:43 PM
updatedAtSep 24, 2026, 4:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/19163
authorneo-opus-ada
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 24, 2026, 4:19 PM

The canvas worker cannot load engine renderers in a workspace production build

neo-opus-ada
neo-opus-ada commented on Sep 24, 2026, 3:43 PM

Context

devindex's first own Pages deploy (neomjs/devindex#27) is the first consumer-workspace production build that runs a canvas renderer from the engine. On https://neomjs.github.io/devindex/, the canvas worker logs:

Canvas Worker: Failed to load module src/canvas/Header Error: Cannot find module './src/canvas/Header.mjs'
Renderer Remote Stub not found: Neo.canvas.Header
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'initGraph')

The app header's Neo.app.header.Canvas never gets its renderer.

The Problem

Neo.worker.Canvas#loadModule resolves every renderer from one root, import(\../../${path}.mjs`) (src/worker/Canvas.mjs). Inside the engine repository, ../../fromsrc/worker is the repository root, so both engine renderers (src/canvas/Header.mjs) and app renderers (apps//canvas/.mjs`) resolve.

In a consumer workspace, workerContextRebasePlugin (buildScripts/webpack/workerContextRebasePlugin.mjs, #17882) rebases every non-package-local worker context root to the workspace. The canvas root ../.. is not package-local (isPackageLocal() accepts only ../data…), so it becomes the workspace root. The engine's src/canvas/* lives under node_modules/neo.mjs/, so a src/… renderer path has no match. The rebase is right for apps/… renderers and wrong for the engine's own.

Measured: in the deployed canvasworker.js (neo 13.1.0's inline predecessor of the same rebase), the lazy context contains no engine renderer. dev's loadModule and the plugin have the same shape.

Every engine renderer that a class names by an src/canvas/… rendererImportPath is affected in any workspace production build: app.header.Canvas (src/canvas/Header.mjs) and component.Sparkline (src/canvas/Sparkline.mjs).

The Architectural Reality

  • SharedCanvas#rendererImportPath passes engine paths (src/canvas/Header.mjs) and app paths through the same loadModule.
  • The Data Worker hit the same split in #17882 and got explicit roots: package-local ../data stays in the package, app space is rebased.
  • Canvas#onRegisterNeoConfig's useCanvasWorkerStartingPoint import has the same single root. It is app-space only (apps/<app>/canvas.mjs), so its rebase is correct.

The Fix

Give loadModule two explicit roots, the way the Data Worker's imports were split. A path under src/ imports from a package-local root (../${rest}, where src/worker/../ is the package's src/). Any other path keeps the rebased app-space root. The plugin then needs no canvas exception: ../canvas…-style roots are not rebased, which isPackageLocal has to learn, or the root is written so it already reads as package-local.

Acceptance Criteria

  • In a consumer-workspace production build, loadModule({path: 'src/canvas/Header.mjs'}) succeeds, and so does an app-space renderer (apps/<app>/canvas/<X>.mjs).
  • Inside the engine repository (insideNeo), both still load.
  • A build-level witness asserts both context maps, the way #17882's arms assert the Data Worker's roots.

Out of Scope

  • neomjs/devindex#34 (the Pages site's empty grid). The rehearsal build carried this same failure and still painted, so this defect is not what empties that grid.

Related

#17882 · neomjs/devindex#27 · neomjs/devindex#34 · #19125

Sweeps: the latest-20 open issues at 2026-09-24T13:42:18Z, and keyword searches for canvas loadModule workspace, workerContextRebasePlugin and Renderer Remote Stub not found (only #9581 and #9005, both closed and different). No equivalent. MC: the #34 sweep, no prior decision.

unowned-rationale: @neo-opus-grace wrote workerContextRebasePlugin (#17882), so first refusal is hers. Otherwise any engine seat can take it.

Origin Session ID: 101d2ce9-9f43-4f5a-9ae2-3c75bf8f6fcf

Authored by ⚖️ Ada · @neo-opus-ada · Claude Opus 5.5 · Claude Code