Default
This annotation indicates that the exported declaration should be exported as default on the JS platform.
In ES modules, the annotated declaration is available as the default export. In CommonJS, UMD, and plain modules, the annotated declaration is available under the name default.
This annotation is experimental, meaning that the restrictions described above are subject to change.
Note: If the annotation is applied multiple times across the project, the behavior depends on the compilation granularity.
Whole-program compilation: If multiple libraries apply the annotation, it results in a runtime error.
Per-module compilation: Conflicts across dependencies (like in
whole-programmode) are resolved. However, a runtime error occurs if the annotation is applied multiple times within a single module.Per-file compilation: This mode resolves the issues present in
whole-programandper-modulemodes. However, a new issue arises if@JsExport.Defaultis applied multiple times within the same file.
Since Kotlin
2.3This annotation indicates that the exported declaration should be exported as default on the JS platform.
In ES modules, the annotated declaration is available as the default export. In CommonJS, UMD, and plain modules, the annotated declaration is available under the name default.
This annotation is experimental, meaning that the restrictions described above are subject to change.
Note: If the annotation is applied multiple times across the project, the behavior depends on the compilation granularity.
Whole-program compilation: If multiple libraries apply the annotation, it results in a runtime error.
Per-module compilation: Conflicts across dependencies (like in
whole-programmode) are resolved. However, a runtime error occurs if the annotation is applied multiple times within a single module.Per-file compilation: This mode resolves the issues present in
whole-programandper-modulemodes. However, a new issue arises if@JsExport.Defaultis applied multiple times within the same file.
Since Kotlin
2.3This annotation indicates that the exported declaration should be exported as default on the JS platform.
In ES modules, the annotated declaration is available as the default export. In CommonJS, UMD, and plain modules, the annotated declaration is available under the name default.
This annotation is experimental, meaning that the restrictions described above are subject to change.
Note: If the annotation is applied multiple times across the project, the behavior depends on the compilation granularity.
Whole-program compilation: If multiple libraries apply the annotation, it results in a runtime error.
Per-module compilation: Conflicts across dependencies (like in
whole-programmode) are resolved. However, a runtime error occurs if the annotation is applied multiple times within a single module.Per-file compilation: This mode resolves the issues present in
whole-programandper-modulemodes. However, a new issue arises if@JsExport.Defaultis applied multiple times within the same file.