How to use module import in nodejs
Issue #752 Use esm npm install esm In our code, import as normal const fs = require('fs'); // intended to be run after babel, and in ./dist folder import factory from 'data' const shell = require('shelljs') Then use esm to convert { "name": "generator", "version": "1.0.0", "main": "index.js", "scripts": { "start": "npx babel index.js --out-file dist/index.js && node -r esm dist/index.js" } } Read more https://stackoverflow.com/questions/45854169/how-can-i-use-an-es6-import-in-node-js