I need some help learning webpack for kotlin multi...
# javascript
n
I need some help learning webpack for kotlin multiplatform 1.3.50. I see that there can be a webpack.config.d directory that appends configuration to a generated webpack config file, but I can't find any documentation for the syntax of the js files it's expecting. I'd like to be able minify / combine all js dependencies for a production build, but not have the extra processing for dev builds.
b
It's just a plain js code appended to the generated webpack.js file. Have a look at how the baseline of it looks like and write the logic to push or modify the config the way youbwant it
👍 1
m
n
Thanks! That's exactly what I was looking for.
You have no idea how long I've been wanting a mpp js browser example...
Do you know much about phantomJS? I see it as an option but the phantom js repo says it's archived.
I'd love for a way to get the js unit tests to work on Linux
b
Unfortunately it does not work with kotlin 1.3.50
Looking into a fix rn
s
@Big Chungus @mp Doesn't Webpack already perform tree-shaking to do DCE? Why would I want to use this plugin on top of that built in capability?
🤔 1
b
sadly it doesn't
not with gradle, tho
s
To be fair I have noticed webpack is generating an unusually large file even under production mode.
@Big Chungus What's the specific error you get? I was going to try to integrate this into my build process
m
@Sam Garfinkel dce nope - kotlin-dce-js plugin helps but mification - does with configurations that I’ve mentioned previously
b
no errors, just large production file due to dce not working properly
s
@Big Chungus The kotlin dce plugin actually does work correctly, the problem is I have no idea how to make webpack use the minified js. Adding the kotlin-min-js folder as the first
config.resolve.module
doesn't seem to work correctly, as webpack has trouble locating several required modules. But if you want to play around, just add
apply(plugin = "kotlin-dce-js")
. It's now bundled with the kotlin-gradle-plugin directly.
Based my webpack.config.d on this (admittedly old) project: https://github.com/gyulavoros/kotlin-todomvc
n
I could kiss avdim, this example was much needed!