DEV Community

Discussion on: ES6 is the Node way to go

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina)

@w3nl
Agreed import is the way to go TS/JS!

Out of curiousity, what are the steps you use to import/export without a build step? I have been reading a bit of the docs and found that the two ways. Certainly curious to know your approach :)

nodejs.org/docs/latest-v14.x/api/e...

Thread Thread
 
w3nl profile image
Pieter Epeüs Wigboldus

I use the type field in the package.json
Than you say that es modules is your default, and if you need common js, you have to change that file extension to cjs.
(e.g. if some old package need a config file in common js format)

The greatest benefit for me is debugging information, what is going on in the dependencies.
(Packages I made and use in my projects)