Description
When using the V2 fallback service protocol (enabled by new_module_registry), the type field in the JSON request body is always "import", even when the module was loaded via require().
Expected Behavior
The type field should reflect how the module was requested:
"import" - Static or dynamic ES module import
"require" - CommonJS-style require() call
"internal" - Import originated from inside the runtime
Actual Behavior
The type field is always "import", regardless of how the module was loaded.
Root Cause
In src/workerd/server/workerd-api.c++, the V2 fallback callback hardcodes ImportType::IMPORT:
Reproduction
https://github.com/jamesopstad/v2-fallback-service-require-repro
Description
When using the V2 fallback service protocol (enabled by
new_module_registry), thetypefield in the JSON request body is always"import", even when the module was loaded viarequire().Expected Behavior
The
typefield should reflect how the module was requested:"import"- Static or dynamic ES module import"require"- CommonJS-stylerequire()call"internal"- Import originated from inside the runtimeActual Behavior
The
typefield is always"import", regardless of how the module was loaded.Root Cause
In
src/workerd/server/workerd-api.c++, the V2 fallback callback hardcodesImportType::IMPORT:Reproduction
https://github.com/jamesopstad/v2-fallback-service-require-repro