Repository navigation
update: JS compiler features - #5884
Danil Pavlov (danil-pavlov) wants to merge 2 commits into
Conversation
|
|
||
| To change the granularity, set the `kotlin.js.ir.output.granularity` property in your `gradle.properties` file: | ||
|
|
||
| ```none |
There was a problem hiding this comment.
Doesn't gradle.properties use a different syntax? The // text becomes part of the value, rather than a comment.
| To change the granularity, set the `kotlin.js.ir.output.granularity` property in your `gradle.properties` file: | ||
|
|
||
| ```none | ||
| kotlin.js.ir.output.granularity=whole-program // 'per-module' is the default |
There was a problem hiding this comment.
| kotlin.js.ir.output.granularity=whole-program // 'per-module' is the default | |
| # Default: per-module | |
| kotlin.js.ir.output.granularity=whole-program |
| @@ -4,6 +4,74 @@ Kotlin/JS includes compiler features to optimize code for performance, size, and | |||
There was a problem hiding this comment.
Should we update the intro to cover the expanded scope?
| This works through the compilation process, which transforms Kotlin code into an intermediate representation (IR) before | ||
| generating the JavaScript code. | ||
|
|
||
| ## Configure output JavaScript versions |
There was a problem hiding this comment.
Should we duplicate the instructions here, if they are already covered in https://kotlinlang.org/docs/js-project-setup.html#set-an-ecmascript-target? Maybe crosslink instead?
There was a problem hiding this comment.
It's just a feature overview of the compiler with links to additional info in the corresponding pages
|
|
||
| ## Configure output JavaScript versions | ||
|
|
||
| The Kotlin/JS compiler can generate JavaScript for the ES5, ES2015, and ES2020 versions of the ECMAScript standard. |
There was a problem hiding this comment.
| The Kotlin/JS compiler can generate JavaScript for the ES5, ES2015, and ES2020 versions of the ECMAScript standard. | |
| The Kotlin/JS compiler can generate JavaScript for the ES5, ES2015, and ES2020 versions of the ECMAScript standard. Choose the newest version supported by your target environment. |
| You can choose how the compiler outputs `.js` files in your project: | ||
|
|
||
| * **Per module** (default). The compiler outputs a separate `.js` file for each project module. | ||
| * **Whole program**. The compiler compiles the whole project into a single `.js` file. |
There was a problem hiding this comment.
| * **Whole program**. The compiler compiles the whole project into a single `.js` file. | |
| * **Whole program:** generates a single `.js` file for the whole program. |
|
|
||
| * **Per module** (default). The compiler outputs a separate `.js` file for each project module. | ||
| * **Whole program**. The compiler compiles the whole project into a single `.js` file. | ||
| * **Per file**. The compiler generates one (or two, if the file contains exported declarations) `.js` file per each Kotlin file. |
There was a problem hiding this comment.
| * **Per file**. The compiler generates one (or two, if the file contains exported declarations) `.js` file per each Kotlin file. | |
| * **Per file:** generates one `.js` file for each Kotlin file, or two if the file contains exported declarations. |
| ```none | ||
| kotlin.js.ir.output.granularity=whole-program // 'per-module' is the default | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Should we mention that it's availavle for ES2015 or ES2020 only?
|
|
||
| ## Configure output granularity | ||
|
|
||
| You can choose how the compiler outputs `.js` files in your project: |
There was a problem hiding this comment.
Can subsequent bundling change how that output is divided into files?
There was a problem hiding this comment.
I wouldn't go into such details here
| kotlin.js.ir.output.granularity=whole-program // 'per-module' is the default | ||
| ``` | ||
|
|
||
| For more details, including the requirements for the per-file mode, see [Configure output granularity](js-project-setup.md#configure-output-granularity). |
There was a problem hiding this comment.
| For more details, including the requirements for the per-file mode, see [Configure output granularity](js-project-setup.md#configure-output-granularity). | |
| For configuration details, see [Configure output granularity](js-project-setup.md#configure-output-granularity). |
Uh oh!
There was an error while loading. Please reload this page.