The removal of the ^ anchor in #9580 and #9581 resolved the path matching for app and chunk resolution (since context strings begin with ./), but removing the anchor completely caused the regexes to broadly match backend Node scripts if their paths contained the keywords further down the substring tree.
For example:
./ai/examples/test-agent.mjs matched examples/
./apps/devindex/services/Manager.mjs matched apps/
./examples/form/field/fileupload/server.mjs matched examples/
This resulted in Webpack attempting to bundle Node core modules (node:stream, node:util), throwing UnhandledSchemeError.
The fix anchors the regex correctly with ^\.\/ to strictly target the intended folders at the root, and adds server\.mjs and devindex\/services to webpackExclude as negative safeties against mixing backend scripts into worker chunk maps.
The removal of the
^anchor in#9580and#9581resolved the path matching for app and chunk resolution (since context strings begin with./), but removing the anchor completely caused the regexes to broadly match backend Node scripts if their paths contained the keywords further down the substring tree.For example:
./ai/examples/test-agent.mjsmatchedexamples/./apps/devindex/services/Manager.mjsmatchedapps/./examples/form/field/fileupload/server.mjsmatchedexamples/This resulted in Webpack attempting to bundle Node core modules (
node:stream,node:util), throwingUnhandledSchemeError. The fix anchors the regex correctly with^\.\/to strictly target the intended folders at the root, and addsserver\.mjsanddevindex\/servicestowebpackExcludeas negative safeties against mixing backend scripts into worker chunk maps.