🚀 Feature Request: [Wrangler] implement nodeJsCompatModule
support
#3569
Labels
enhancement
New feature or request
node compat
Relating to the differences between the Workers environment and Node
wrangler
Relating to the Wrangler CLI tool
Describe the solution
This new workerd module type instructors the runtime to enter a "node.js compatibility" mode when executing code in such modules. This includes
Buffer
)require()
without thenode:...
prefix (e.g.require("url")
)I think the basic requirement is to add a new "rule type" to Wrangler that is
nodeJsCompatModule
.One difficulty will be to determine the Mime type to map it to, since the upload HTTP Form requires each module to have a mime type. See
workers-sdk/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts
Lines 11 to 26 in 1258dc6
This will need to be agreed with EWC so that it can determine what module type to use when deploying the modules to the edge.
But I think this work could be completed before the EWC work, since it is entirely opt-in. We would just delay documenting it until it is ready end to end.
The text was updated successfully, but these errors were encountered: