I have a Kotlin multiplatform project with JVM and JS. When executing jsRun
gradle task to start the webpack server, it fails with the following error:
Waiting for changes to input files of tasks... (ctrl-d then enter to exit)
[webpack-cli] TypeError: cli.isMultipleCompiler is not a function
[webpack-cli] TypeError: cli.isMultipleCompiler is not a function
at Command.<anonymous> (C:[email protected]:146:35)
at async Promise.all (index 1)
at async Command.<anonymous> (C:MyProjectbuildjsnode_moduleswebpack-clilibwebpack-cli.js:1687:7)
Compilation succeeds and I can serve the project via Ktor, the problem seems to be the webpack dev server.
The package.json
that kotlin gradle plugin generates seems to use webpack-cli 4.9.0
.
{
"name": "MyProject-client",
"version": "1.0.0",
"main": "kotlin/MyProject-client.js",
"devDependencies": {
"sass-loader": "13.0.0",
"sass": "1.53.0",
"style-loader": "3.3.1",
"css-loader": "6.7.1",
"resolve-url-loader": "5.0.0",
"webpack": "5.57.1",
"webpack-cli": "4.9.0",
"format-util": "1.0.5",
"source-map-loader": "3.0.0",
"webpack-dev-server": "4.3.1",
"dukat": "0.5.8-rc.4"
},
"dependencies": {},
"peerDependencies": {},
"optionalDependencies": {},
"bundledDependencies": []
}
This says that it’s a bug in webpack-cli 4.9.0
and suggests upgrading to 4.10.0
. I don’t know if/how webpack versions can be changed in Kotlin/JS.