Latest Update: April 2022
The usage of the module
field in Node.js is not officially defined and is not on the roadmap for support. The Node.js community has instead embraced package exports, which they view as more adaptable.
Despite this, JavaScript bundlers will continue to accommodate the module
field for practical reasons. The esbuild documentation provides guidance on when to utilize module
, along with other associated fields like main
and browser
.
Original Question Asked
Is the use of "module"
an official npm standard or just a common practice?
Although originally a proposal, it is likely to gain widespread acceptance due to its current usage patterns.
Where can I find documentation regarding this topic?
Documentation can be accessed here initially, and later moved to this location.
What is the purpose of using it?
It serves to enhance ES6 Module compatibility within the Node ecosystem. Further discussions are available here and here. Additionally, Rich Harris delves deeper into the subject in his blog post.