admin管理员组文章数量:1187864
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 :
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 : 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.
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.
Share Improve this question asked Oct 12, 2021 at 9:08 MokyxMokyx 1614 bronze badges 1- Github discussion here – vsync Commented Sep 29, 2022 at 15:52
3 Answers
Reset to default 21Had the same issue: adding this option to the project gradle.properties
kotlin.js.webpack.major.version=4
fixed it - reference: https://kotlinlang.org/docs/js-project-setup.html#webpack-version
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"
}
Evgeny's answer didn't work here. Now after 2 days of banging head, and reading kotlin plugin source-code, only the following worked here:
// build.gradle.kts file
kotlinYarn {
resolution("webpack", "5.73.0")
resolution("webpack-cli", "4.10.0")
}
It will print a warning when running the task kotlinNpmInstall but the app will run.
本文标签: javascriptKotlinJSGradle PluginUnable to load 39webpackcliserve39 commandStack Overflow
版权声明:本文标题:javascript - KotlinJS, Gradle Plugin : Unable to load '@webpack-cliserve' command - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738345368a2077961.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论