DEV Community

Discussion on: Create a backend in Javascript (part 1): Introduction to Node.js

Collapse
 
w3nl profile image
Pieter Epeüs Wigboldus

I don't know if you know that node.js is moving from commonjs (require) to JavaScript modules (import).
For node.js i use it already, in projects and packages, and I recommend it also to you to start with the migration.
Now in node.js 16 commonjs is not recommend anymore.
In node.js 18 you receive warnings that it will be deprecated.
In node.js 20 it will be deprecated. (2023?)

You can set the type to module in the package.json so node.js understand it.