LearnNewsExamplesServices
Frontmatter
id12297
titleWebpack build broken: src/worker/Data.mjs lazy-import glob bundles test/ specs (pulls @playwright/test → node-only modules)
stateClosed
labels
bugbuild
assigneesneo-opus-ada
createdAtJun 1, 2026, 11:00 AM
updatedAtJun 1, 2026, 12:18 PM
githubUrlhttps://github.com/neomjs/neo/issues/12297
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 1, 2026, 12:18 PM

Webpack build broken: src/worker/Data.mjs lazy-import glob bundles test/ specs (pulls @playwright/test → node-only modules)

neo-opus-ada
neo-opus-ada commented on Jun 1, 2026, 11:00 AM

Severity: build-breaking (dev)

npm run build-all fails — webpack tries to bundle @playwright/test (and its node-only deps path, chromium-bidi) into the browser Data-worker bundle.

Root cause

src/worker/Data.mjs createInstance does a lazy dynamic import() with:

  • webpackInclude: /(?:apps|docs\/app|examples|src\/data)\/.*\.mjs$/
  • webpackExclude: /(?:\/|\\)(buildScripts|dist|node_modules…|ai…|\.claude…|server\.mjs|devindex…)/

The exclude does not cover test/. Unit specs live at test/playwright/unit/apps/portal/... (canonical mirror path), whose apps/...Component.spec.mjs tail matches the `apps/.*.mjs# Webpack build broken: src/worker/Data.mjs lazy-import glob bundles test/ specs (pulls @playwright/test → node-only modules)

Severity: build-breaking (dev)

npm run build-all fails — webpack tries to bundle @playwright/test (and its node-only deps path, chromium-bidi) into the browser Data-worker bundle.

Root cause

src/worker/Data.mjs createInstance does a lazy dynamic import() with:

  • webpackInclude: /(?:apps|docs\/app|examples|src\/data)\/.*\.mjs$/
  • webpackExclude: /(?:\/|\\)(buildScripts|dist|node_modules…|ai…|\.claude…|server\.mjs|devindex…)/

The exclude does not cover test/. Unit specs live at test/playwright/unit/apps/portal/... (canonical mirror path), whose apps/...Component.spec.mjs tail matches the include. Those specs import {test} from '@playwright/test' → webpack pulls playwright-core (node-only) into the browser bundle → Can't resolve 'path' / 'chromium-bidi/...'.

This was latent until the first unit specs mirrored an apps/ path — test/playwright/unit/apps/portal/view/news/{discussions,pulls}/Component.spec.mjs (#12288 + #12213) are the first two, so they triggered it.

The fix

Add a test/ segment to the webpackExclude so the lazy app-module loader never bundles the test tree (test specs must never enter the app bundle). One-line regex change; no spec relocation (the canonical test/playwright/unit/<mirror> placement is correct).

Acceptance Criteria

  • npm run build-all succeeds with the portal unit specs present in test/playwright/unit/apps/.
  • No @playwright/test / path / chromium-bidi resolution errors in the Data-worker bundle.
tobiu referenced in commit d5c1f46 - "fix(build): exclude test/ from Data worker lazy-import glob to unbreak webpack (#12297) (#12298) on Jun 1, 2026, 12:18 PM
tobiu closed this issue on Jun 1, 2026, 12:18 PM