Is it possible to convert requirejs modules to commonjs?

后端 未结 3 1092
情书的邮戳
情书的邮戳 2021-02-15 22:40

It\'s already possible to convert commonjs modules to requirejs, but I still want to know whether it\'s possible to do the reverse. Is there any way to convert requireJS modules

3条回答
  •  不知归路
    2021-02-15 23:25

    Yes, it is possible. Many sites including Sound Cloud have developed their own conversion tool.

    Mozilla has developed a nice little module called SweetJS. Basically allows you to define macros in JavaScript. To use in Node.js, you'll need to use it's binary to actually use the macros, as it's not available through runtime.

    http://sweetjs.org/

    EDIT:

    Yehuda, one of the developers of Ember.js has released a transpiler module.

    It is written in Ruby, and not JavaScript, but perhaps someone will convert it over. Nonetheless, you can use it within Node.js by forking a ruby process.

提交回复
热议问题