DEV Community

Discussion on: Import Local JSON In Node.js v8.5 Experimental Modules

 
geoff profile image
Geoff Davis

I'm guessing the new mjs thing is an all-or-nothing thing?

I believe that is the case. To be honest I do not know much about how Node works behind-the-scenes, but it appears that switching between --experimental-modules and CommonJS modules would be like using straight ES201* code or sending it through Babel.

... I do have an .mjs file there (you can old-style require them, too, if you add the extension) ...

Good to know! I like it because I don't have to switch headspace anymore when working on frontend and backend code.