Hello every one, I am getting that webpack error a...
# javascript
a
Hello every one, I am getting that webpack error again. Any one else experiencing this?
Copy code
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class.java) {
    rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().versions.webpackDevServer.version =
        "4.0.0-rc.0" // tried "4.0.0", "4.1.0"
}
Nothing works
r
It's working for me. I have this configuration:
Copy code
rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension> {
                    versions.webpackDevServer.version = "4.0.0"
                    versions.webpack.version = "5.51.1"
                }
a
So after a deep dive, I figured that it is working well with
kotlin("multiplatform")
plugin but doesn't work with
kotlin("js")
plugin. Are you using the
kotlin("js")
plugin?
r
Yes.
kotlin("js")
Perhaps I have some dependency cached somewhere.
But I have cleaned the project.
Can you try to download and run any of my kvision examples?
Do you use IR or legacy?
and latest Kotlin?
a
I am using IR, and I am testing on Kotlin 1.5.30. I should say that this is a multimodule project
t
CLI also required
r
webpack-cli 4.7.1
is used in my projects without issues ...
a
With this configuration on
kotlin("js")
Copy code
rootProject.extensions.configure<NodeJsRootExtension> {
 versions.apply {
   webpackDevServer.version = "4.1.0"
   webpack.version = "5.51.2"
   webpackCli.version = "4.7.2" // also, "4.8.0"
 }
}
I get
Copy code
> [webpack-cli] You need to install 'webpack-dev-server' for running 'webpack serve'.
  Error: Cannot find module 'webpack-dev-server'
  Require stack:
But works on
kotlin("multiplatform")
In summary
kotlin("js") version "1.5.30"
webpack="5.51.1","5.51.2"
webpackDevServer="4.1.0"
webpackCli="4.7.1"
Copy code
> [webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
   - options has an unknown property 'contentBase'. These properties are valid:
While
kotlin("js") version "1.5.30"
webpack="5.51.1","5.51.2"
webpackDevServer="4.1.0"
webpackCli="4.7.2","4.8.0"
Copy code
[webpack-cli] You need to install 'webpack-dev-server' for running 'webpack serve'.
Error: Cannot find module 'webpack-dev-server'
Require stack:
r
And how about dev-server 4.0.0 ?
Isn't
contentBase
your own option set inside
webpack.config.d
?
contentBase
was renamed to
static
a
maybe I check that then. I sure did have content base setup
Turn out I already did switch from
contentBase
to
static
, explains why I have no issues on
kotlin("multplatform")
but I wonder whats going on on
kotlin("js")
Can I see any of your configurations?