How to convert Scala.js application to CommonJS module?

*爱你&永不变心* 提交于 2019-12-04 06:01:45

Scala.js 0.6.13 and onward

Put this in your build file:

scalaJSModuleKind := ModuleKind.CommonJSModule

Scala.js 0.6.5 to 0.6.12

Put this in your build file (explanation see below):

scalaJSOutputWrapper := ("var __ScalaJSEnv = { exportsNamespace: exports };", "")

Scala.js 0.5.4 to 0.6.4

You can tell Scala.js where to send the stuff it exports. To make a CommonJS module, simply prepend this:

var __ScalaJSEnv = {
   exportsNamespace: exports
};

to the .js file produced by fastOptJS/fullOptJS.

Pre Scala.js 0.5.4

Please upgrade :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!