0

I have a module which runs commands with user input I want to import a file based on user input present code in commonJS


async function execute(name, ...args) {
  let cmd = require(`./commands/${name}`);
  ...
}

I'm unable to write a ES6 code with a similar structure

async function execute(name, ...args){
   import `./commands/${name}` as cmd;
}

0 Answers0