KotlinJS中的Kootlin失败的世界没有定义

我有一个名为Main.kt的Kotlin文件

 package com.ahp.mui fun main(args: Array) { println("...") println("Hello World") } 

项目设置为KotlinJS项目。

一旦我编译,我看到下面的文件正在生成:

 target/production/ahp-mui/ahp-mui.js target/production/ahp-mui/ahp-mui.js.map target/production/ahp-mui/ahp-mui.meta.js 

主生成的文件包含:

 (function (Kotlin) { 'use strict'; var _ = Kotlin.defineRootPackage(null, /** @lends _ */ { com: Kotlin.definePackage(null, /** @lends _.com */ { ahp: Kotlin.definePackage(null, /** @lends _.com.ahp */ { mui: Kotlin.definePackage(null, /** @lends _.com.ahp.mui */ { main_kand9s$: function (args) { Kotlin.println('...'); Kotlin.println('Hello World'); } }) }) }) }); Kotlin.defineModule('ahp-mui', _); _.com.ahp.mui.main_kand9s$([]); }(Kotlin)); 

现在我把这个文件包含在index.html中的根目录下:

     TESTING    

现在通过IntelliJ直接提供index.html文件( http://localhost:63342/ahp-wui/ahp-mui/index.html?_ijt=n55ajlpfutv6b22n56d59jv1rn ),我看到Kotlin参数没有定义。

 ahp-mui.js:16Uncaught ReferenceError: Kotlin is not defined 

我正确地做这个? 我是否应该导入任何其他将包括丢失的Kotlinvariables?

IntelliJ应该在某处放置了一个Kotlin标准库.js文件。 这是在创建项目时配置的。 在编译.js文件之前,您必须将其包含在HTML文件中。