简体   繁体   English

如何将常见的 js 转换为 ES6 模块?

[英]How to convert common js to ES6 modules?

I know that there are many solutions to convert es6 to js.我知道将es6转换为js的解决方案有很多。 but when I was searching, I didn't find any solution converting js to es6!但是当我搜索时,我没有找到任何将js转换为es6的解决方案! in my case I really need to convert this code to es6:就我而言,我真的需要将此代码转换为 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:我不熟悉 m3o,但我对您发布的内容的 ES6 翻译将是:

import { default as m3o } from 'm3o';
m3o(process.env.M3O_API_TOKEN);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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