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-program mode) 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-program and per-module modes. However, a new issue arises if @JsExport.Default is applied multiple times within the same file.

Since Kotlin

2.3

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-program mode) 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-program and per-module modes. However, a new issue arises if @JsExport.Default is applied multiple times within the same file.

Since Kotlin

2.3

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-program mode) 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-program and per-module modes. However, a new issue arises if @JsExport.Default is applied multiple times within the same file.

Since Kotlin

2.3