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:
- 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.
- Asynchronous Module Definition (AMD), which is in particular used by require.js library.
-
CommonJS convention, widely used by node.js/npm (
require
function andmodule.exports
object) - 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.