Usage: kotlinc-js where advanced options include: -Xcache-directory= Path to the cache directory. -Xenable-js-scripting Enable experimental support for .kts files using K/JS (with '-Xir' only). -Xerror-tolerance-policy Set up an error tolerance policy (NONE, SEMANTIC, SYNTAX, ALL). -Xenable-extension-functions-in-externals Enable extension function members in external interfaces. -Xfake-override-validator Enable the IR fake override validator. -Xfriend-modules= Paths to friend modules. -Xfriend-modules-disabled Disable internal declaration export. -Xgenerate-dts Generate a TypeScript declaration .d.ts file alongside the JS file. This is available only in the IR backend. -Xgenerate-polyfills Generate polyfills for features from the ES6+ standards. -Xinclude= Path to an intermediate library that should be processed in the same manner as source files. -Xir-base-class-in-metadata Write base classes into metadata. -Xir-build-cache Use the compiler to build the cache. -Xir-dce Perform experimental dead code elimination. -Xir-dump-declaration-ir-sizes-to-file= Dump the IR size of each declaration into a file. The format will be chosen automatically depending on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types. -Xir-dce-dump-reachability-info-to-file= Dump reachability information collected about declarations while performing DCE to a file. The format will be chosen automatically based on the file extension. Supported output formats include JSON for .json, a JS const initialized with a plain object containing information for .js, and plain text for all other file types. -Xir-dce-print-reachability-info Print reachability information about declarations to 'stdout' while performing DCE. -Xir-dce-runtime-diagnostic={log|exception} Enable runtime diagnostics instead of removing declarations when performing DCE. -Xir-generate-inline-anonymous-functions Lambda expressions that capture values are translated into in-line anonymous JavaScript functions. -Xir-keep Comma-separated list of fully qualified names not to be eliminated by DCE (if it can be reached), and for which to keep non-minified names. -Xir-minimized-member-names Minimize the names of members. -Xir-module-name= Specify the name of the compilation module for the IR backend. -Xir-new-ir2js New fragment-based 'ir2js'. -Xir-only Disable the pre-IR backend. -Xir-per-file Generate one .js file per source file. -Xir-per-module Generate one .js file per module. -Xir-per-module-output-name Add a custom output name to the split .js files. -Xir-produce-js Generate a JS file using the IR backend. This option also disables the pre-IR backend. -Xir-produce-klib-dir Generate an unpacked klib into the parent directory of the output JS file. In combination with '-meta-info', this generates both IR and pre-IR versions of the library. -Xir-produce-klib-file Generate a packed klib into the file specified by '-output'. This disables the pre-IR backend. -Xir-property-lazy-initialization Perform lazy initialization for properties. -Xir-safe-external-boolean Wrap access to external 'Boolean' properties with an explicit conversion to 'Boolean'. -Xir-safe-external-boolean-diagnostic={log|exception} Enable runtime diagnostics when accessing external 'Boolean' properties. -Xoptimize-generated-js Perform additional optimizations on the generated JS code. -Xpartial-linkage-loglevel={info|warning|error} Define the compile-time log level for partial linkage. -Xpartial-linkage={enable|disable} Use partial linkage mode. -Xplatform-arguments-in-main-function JS expression that will be executed in runtime and be put as an Array parameter of the main function -Xstrict-implicit-export-types Generate strict types for implicitly exported entities inside d.ts files. This is available in the IR backend only. -Xtyped-arrays Translate primitive arrays into JS typed arrays. -Xes-classes Let generated JavaScript code use ES2015 classes. -Xes-generators Enable ES2015 generator functions usage inside the compiled code -Xwasm Use the experimental WebAssembly compiler backend. -Xwasm-debug-info Add debug info to the compiled WebAssembly module. -Xwasm-enable-array-range-checks Turn on range checks for array access functions. -Xwasm-enable-asserts Turn on asserts. -Xwasm-generate-wat Generate a .wat file. -Xwasm-kclass-fqn Enable support for 'KClass.qualifiedName'. -Xwasm-target Set up the Wasm target (wasm-js or wasm-wasi). -Xwasm-use-traps-instead-of-exceptions Use traps instead of throwing exceptions. -Xallow-any-scripts-in-source-roots Allow compiling scripts along with regular Kotlin sources. -Xallow-kotlin-package Allow compiling code in the 'kotlin' package, and allow not requiring 'kotlin.stdlib' in 'module-info'. -Xcheck-phase-conditions Check pre- and postconditions of IR lowering phases. -Xcheck-sticky-phase-conditions Run sticky condition checks on subsequent phases. Implicitly enables '-Xcheck-phase-conditions'. -Xcommon-sources= Sources of the common module that need to be compiled together with this module in multiplatform mode. They should be a subset of sources passed as free arguments. -Xcontext-receivers Enable experimental context receivers. -Xdisable-default-scripting-plugin Don't enable the scripting plugin by default. -Xdisable-phases Disable backend phases. -Xdont-warn-on-error-suppression Don't report warnings when errors are suppressed. This only affects K2. -Xdump-directory Dump the backend state into this directory. -Xdump-fqname Dump the declaration with the given FqName. -Xdump-perf= Dump detailed performance statistics to the specified file. -Xenable-builder-inference Use builder inference by default for all calls with lambdas that can't be resolved without it. The corresponding calls' declarations may not be marked with @BuilderInference. -Xklib-enable-signature-clash-checks Enable signature uniqueness checks. -Xexpect-actual-classes 'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. Kotlin reports a warning every time you use one of them. You can use this flag to mute the warning. -Xexplicit-api={strict|warning|disable} Force the compiler to report errors on all public API declarations without an explicit visibility or a return type. Use the 'warning' level to issue warnings instead of errors. -Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors. Warning: This mode is not backward compatible and might cause compilation errors in previously compiled code. -Xfragment-refines=: Declare that refines with the dependsOn/refines relation. -Xfragment-sources=: Add sources to a specific fragment of a multiplatform compilation. -Xfragments= Declare all known fragments of a multiplatform compilation. -Xignore-const-optimization-errors Ignore all compilation exceptions while optimizing some constant expressions. -Xenable-incremental-compilation Enable incremental compilation. -Xinference-compatibility Enable compatibility changes for the generic type inference algorithm. -Xinline-classes Enable experimental inline classes. -Xintellij-plugin-root= Path to 'kotlin-compiler.jar' or the directory where the IntelliJ IDEA configuration files can be found. -Xlegacy-smart-cast-after-try Allow 'var' smart casts even in the presence of assignments in 'try' blocks. -Xlist-phases List backend phases. -Xmetadata-klib Produce a klib that only contains the metadata of declarations. -Xmetadata-version Change the metadata version of the generated binary files. -Xmulti-platform Enable language support for multiplatform projects. -Xnew-inference Enable the new experimental generic type inference algorithm. -Xno-check-actual Do not check for the presence of the 'actual' modifier in multiplatform projects. -Xno-inline Disable method inlining. -Xklib-normalize-absolute-path Normalize absolute paths in klibs. -Xphases-to-dump Dump the backend's state both before and after these phases. -Xphases-to-dump-after Dump the backend's state after these phases. -Xphases-to-dump-before Dump the backend's state before these phases. -Xphases-to-validate Validate the backend's state both before and after these phases. -Xphases-to-validate-after Validate the backend's state after these phases. -Xphases-to-validate-before Validate the backend's state before these phases. -Xplugin= Load plugins from the given classpath. -Xcompiler-plugin=,:=,= Register a compiler plugin. -Xprofile-phases Profile backend phases. -Xklib-relative-path-base Provide a base path to compute the source's relative paths in klib (default is empty). -Xrender-internal-diagnostic-names Render the internal names of warnings and errors. -Xreport-output-files Report the source-to-output file mapping. -Xreport-perf Report detailed performance statistics. -Xself-upper-bound-inference Support inferring type arguments from the self-type upper bounds of the corresponding type parameters. -Xskip-metadata-version-check Allow loading classes with bad metadata versions and pre-release classes. -Xskip-prerelease-check Allow loading pre-release classes. -Xsuppress-api-version-greater-than-language-version-error Suppress error about API version greater than language version. Warning: This is temporary solution (see KT-63712) intended to be used only for stdlib build. -Xsuppress-version-warnings Suppress warnings about outdated, inconsistent, or experimental language or API versions. -Xunrestricted-builder-inference Eliminate builder inference restrictions, for example by allowing type variables to be returned from builder inference calls. -Xuse-fir-extended-checkers Use extended analysis mode based on the frontend IR. Warning: This feature is not yet production-ready. -Xuse-fir-ic Compile using frontend IR internal incremental compilation. Warning: This feature is not yet production-ready. -Xuse-fir-lt Compile using the LightTree parser with the frontend IR. -Xuse-ir-fake-override-builder Generate fake overrides via IR. See KT-61514 -Xuse-k2 Compile using the experimental K2 compiler pipeline. No compatibility guarantees are provided yet. -Xverbose-phases Be verbose while performing the given backend phases. Advanced options are non-standard and may be changed or removed without any notice. OK