DEV Community

loading...

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

Collapse
miketalbot profile image
Mike Talbot

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

Collapse
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.