So I am posted a few days ago about webpack failin...
# javascript
r
So I am posted a few days ago about webpack failing on xxx-jslegacy dependencies and thought i might try again as I am a bit stumped with trying to figure out where these dependencies are introduced. I'm wondering if someone might be able to point me to a good example of the dependencies required for a kotlin-js / react project as it look like i have gotten something wrong there. i have :
Copy code
val commonMain by getting {
    dependencies {
        implementation(project(":shared"))
        implementation("org.jetbrains.kotlinx:kotlinx-datetime:$ver_kotlinx_datetime")
        implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$ver_kotlinx_serialization_core")
        implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$ver_kotlinx_serialization_core")
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$ver_coroutines_core")
        implementation("io.ktor:ktor-client-core:$ver_ktor")
        implementation("io.insert-koin:koin-core:$ver_koin")
    }
}
val jsMain by getting {
    dependencies {
        implementation("org.jetbrains:kotlin-react:$ver_kotlin_react")
        implementation("org.jetbrains:kotlin-styled:$ver_kotlin_styled")
        implementation(npm("react-youtube-lite", "1.0.1"))
        implementation(npm("react-share", "~4.2.1"))

        // todo shouldn't be need but breaks build runtime/webpack
        //implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))

        implementation("com.ccfraser.muirwik:muirwik-components:0.7.0") {
            exclude(group = "org.jetbrains.kotlin-wrappers", module = "kotlin-styled")
        }
        //<https://github.com/CookPete/react-player>
        //implementation(npm("react-player", "2.9.0"))
    }
    //implementation("org.jetbrains.kotlinx:kotlinx-datetime-js:$ver_kotlinx_datetime")
}
versions are
Copy code
ver_kotlin_react=17.0.1-pre.148-kotlin-1.4.21
ver_kotlin_styled=5.2.1-pre.146-kotlin-1.4.30
ver_react=17.0.1
ver_styled_cmp=5.3.0
ver_kotlin=1.4.32
the errors i get are:
t
r
So now i have changed to the most recent
Copy code
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:$ver_kotlin_react")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:$ver_kotlin_react")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-styled:$ver_kotlin_styled")
//                implementation(npm("react-youtube-lite", "1.0.1"))
//                implementation(npm("react-share", "~4.2.1"))

                // todo shouldn't be need but breaks build runtime/webpack
                //implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))

                implementation("com.ccfraser.muirwik:muirwik-components:0.7.0") {
                    exclude(group = "org.jetbrains.kotlin-wrappers", module = "kotlin-styled")
                }
versions
Copy code
ver_kotlin_react=17.0.2-pre.208-kotlin-1.5.10
ver_kotlin_styled=5.3.0-pre.208-kotlin-1.5.10
ver_kotlin=1.5.10
but now have more legacy files missing?
Copy code
> Task :kotlinNpmInstall
warning workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > ktor-ktor-http-cio-jsLegacy > text-encoding@0.7.0: no longer maintained
warning workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > ktor-ktor-client-core-jsLegacy > text-encoding@0.7.0: no longer maintained
warning workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > ktor-ktor-utils-jsLegacy > text-encoding@0.7.0: no longer maintained
warning workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > ktor-ktor-http-jsLegacy > text-encoding@0.7.0: no longer maintained
warning workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > ktor-ktor-io-jsLegacy > text-encoding@0.7.0: no longer maintained
warning workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > webpack-dev-server > sockjs > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See <https://v8.dev/blog/math-random> for details.
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core@4.11.4" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core@4.11.4" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > kotlin-styled > styled-components@5.3.0" has unmet peer dependency "react@>= 16.8.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > kotlin-styled > styled-components@5.3.0" has unmet peer dependency "react-dom@>= 16.8.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > kotlin-styled > styled-components@5.3.0" has unmet peer dependency "react-is@>= 16.8.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/lab@4.0.0-alpha.56" has unmet peer dependency "react@^16.8.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/lab@4.0.0-alpha.56" has unmet peer dependency "react-dom@^16.8.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > kotlin-react-dom > react-dom@17.0.2" has unmet peer dependency "react@17.0.2".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > @material-ui/styles@4.11.4" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > @material-ui/styles@4.11.4" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > @material-ui/utils@4.11.2" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > @material-ui/utils@4.11.2" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > @material-ui/system@4.11.3" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > @material-ui/system@4.11.3" has unmet peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > react-transition-group@4.4.2" has unmet peer dependency "react@>=16.6.0".
warning "workspace-aggregator-0f273868-ebc7-43a8-b0bf-5e7f575cdc50 > Cuer-remote > muirwik-muirwik-components > @material-ui/core > react-transition-group@4.4.2" has unmet peer dependency "react-dom@>=16.6.0".
errors are
Copy code
Module not found: Error: Can't resolve 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' in '/Users/robmunro/repos/personal/cuer/cuer/build/js/packages/Cuer-remote/kotlin-dce-dev'

Module not found: Error: Can't resolve 'kotlin-wrappers-kotlin-extensions-js-legacy' in '/Users/robmunro/repos/personal/cuer/cuer/build/js/packages/Cuer-remote/kotlin-dce-dev'

Module not found: Error: Can't resolve 'kotlin-wrappers-kotlin-styled-js-legacy' in '/Users/robmunro/repos/personal/cuer/cuer/build/js/packages/Cuer-remote/kotlin-dce-dev'

Module not found: Error: Can't resolve 'kotlin-wrappers-kotlin-react-js-legacy' in '/Users/robmunro/repos/personal/cuer/cuer/build/js/packages/Cuer-remote/kotlin-dce-dev'
it looks from the npm warnings like react is downgraded?
so adding the npm lib dependencies
Copy code
ver_react=17.0.2
ver_styled_cmp=5.3.0
implementation(npm("react", ver_react))
implementation(npm("react-dom", ver_react))
implementation(npm("react-is", ver_react))
implementation(npm("styled-components", ver_styled_cmp))
removes a lot of the npm install warnings but i still get the same missing js-legacy error
Also this is a shared KMP module and it looks like the webpack config is building the js output in the project build folder - which has
kotlinx-serialization-kotlinx-serialization-core-js-legacy.js
(above error is
*-jsLegacy
) which looks like this bug which was fixed last year so should be in the lastest serialization lib surely (1.2.1) https://youtrack.jetbrains.com/issue/KT-43237
t
Kotlin 1.5 - required
r
yes so i updated to 1.5.10 - do you think the recent libraries would support the legacy compiler? i am using muirwik (material UI lib -https://github.com/cfnz/muirwik ) which specifies
js(LEGACY)
so that looks to be what the dependency issue is for the
*-[extensions,styled,react]-js-legacy
dependencies. So removing that lib removed all of them except the
serialization-jsLegacy
issue.
so the serialization legacy looks to be caused by a transient dependency from kotlin-datetime so upgrading his to 0.2.1 fixed it.
👍 1