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
Severity: build-breaking (dev)
npm run build-allfails — webpack tries to bundle@playwright/test(and its node-only depspath,chromium-bidi) into the browser Data-worker bundle.Root cause
src/worker/Data.mjscreateInstancedoes a lazy dynamicimport()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 attest/playwright/unit/apps/portal/...(canonical mirror path), whoseapps/...Component.spec.mjstail 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-allfails — webpack tries to bundle@playwright/test(and its node-only depspath,chromium-bidi) into the browser Data-worker bundle.Root cause
src/worker/Data.mjscreateInstancedoes a lazy dynamicimport()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 attest/playwright/unit/apps/portal/...(canonical mirror path), whoseapps/...Component.spec.mjstail matches the include. Those specsimport {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 thewebpackExcludeso 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 canonicaltest/playwright/unit/<mirror>placement is correct).Acceptance Criteria
npm run build-allsucceeds with the portal unit specs present intest/playwright/unit/apps/.@playwright/test/path/chromium-bidiresolution errors in the Data-worker bundle.