Deprecate process and Buffer globals when not in CJS#5
Deprecate process and Buffer globals when not in CJS#5guybedford wants to merge 1 commit intonodejs:masterfrom
Conversation
|
@mcollina is there a generic benchmark you would suggest trying here? |
This is a pretty strong point. Introducing ESM should probably not be leveraged as an opportunity to "fix" things that need fixing in CJS anyways. In general, either we fix it in CJS, or we don't fix it in ESM. |
|
Thanks @guybedford for opening a conversation on this - I agree with others that, as a design principle, we should probably stay focused on the one goal of supporting ESM in Node, and put other things to the side. I would personally make the stronger claim that it's a non-goal to make the ESM-in-Node environment substitutable with a browser ESM environment. |
|
Ok, agreed, and thanks for feedback. |
|
@zenparsing it is important to clearly define what we mean by "substitutable". To ignore that these decisions affect browsers is to ignore the wider consequences of our decisions, and taking such a stance is not an option in my opinion. |
Currently in ES modules we have the
processandBufferglobals exactly as Node.js currently provides. This PR provides a deprecation path for these globals by only supporting them in CJS through a global proxy approach.Most tests are passing, but this is still a work-in-progress. Opening early so we can start to discuss this.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes