nodejs.dev
nodejs.dev copied to clipboard
Docs suggest no support for ES modules
Some of the /learn
docs assume that the user can only use CommonJS imports/exports. For example:
Another difference is that Node.js uses the CommonJS module system, while in the browser we are starting to see the ES Modules standard being implemented.
In practice, this means that for the time being you use
require()
in Node.js andimport
in the browser. — Differences between Node.js and the Browser
My understanding is that both platforms supports either format. Additionally, each platform uses CommonJS unless told otherwise. Is this an oversight?
Hey, @binyamin, this text was created before ESM release which is quite fresh feature in Node.js. If you would like to update this page with relevant info - PRs are welcome!
hey @rodion-arr I would like to work on this issue if it is still open.
@shikhar13012001 go ahead.