简体   繁体   中英

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);

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM