Home > Blockchain >  Kotlin/JS, Gradle Plugin : Unable to load '@webpack-cli/serve' command
Kotlin/JS, Gradle Plugin : Unable to load '@webpack-cli/serve' command

Time:10-13

I was doing the tutorial for React Kotlin and couldnt even finish the setup step because the server does not start.

The code is unchanged : https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle

Stacktrace:

[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function
[webpack-cli] TypeError: options.forEach is not a function

I saw this issue : https://github.com/webpack/webpack-cli/issues/2990 but I'm unable to implement the fix proposed (change the webpack-cli version and remove the webpack-cli/serve from yarn.lock) because I can't find how to change these on the kotlin js gradle plugin.

Even simple browser application from intelliJ is broken with the same error.

CodePudding user response:

Try to update webpack-cli:

rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class.java) {  
    rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().versions.webpackCli.version = "4.9.0"
}
  • Related