JavaScript Modules

JavaScript Modules

Kotlin allows you to compile your Kotlin projects to JavaScript modules for popular module systems. Here is the list of available options:

  1. Plain. Don't compile for any module system. As usual, you can access a module by its name in the global scope. This option is used by default.
  2. Asynchronous Module Definition (AMD), which is in particular used by require.js library.
  3. CommonJS convention, widely used by node.js/npm (require function and module.exports object)
  4. Unified Module Definitions (UMD), which is compatible with both AMD and CommonJS, and works as "plain" when neither AMD nor CommonJS is available at runtime.

登录查看完整内容