DEV Community


Discussion on: How to use ES6 import syntax in Node.js

miketalbot profile image
Mike Talbot

Pretty sure you can import from files that end with an .mjs extension in node 14+

amanhimself profile image
Aman Mittal Author

Yeah, .mjs is another alternative but if one is using 14+, then I personally think adding "type": "module" in package.json is more viable.