Skip to content
Advertisement

How to convert common js to ES6 modules?

I know that there are many solutions to convert es6 to js. but when I was searching, I didn’t find any solution converting js to es6! in my case I really need to convert this code to es6:

const m3o = require("m3o")(process.env.M3O_API_TOKEN);

Advertisement

Answer

I’m not familiar with m3o, but my ES6 translation of what you posted would be:

import { default as m3o } from 'm3o';
m3o(process.env.M3O_API_TOKEN);
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement