how do i use the gradle frontend plugin nowadays? ...
# javascript
t
how do i use the gradle frontend plugin nowadays? https://github.com/Kotlin/kotlin-frontend-plugin/blob/master/README.md looks a bit outdated and indeed, i am unable to use this plugin with kotlin 1.3.41 (
Cannot add task 'processResources' as a task with that name already exists.
). Or maybe it's gotten deprecated and i do not need it anymore?
b
It did get deprecated, however the new alternative is not documented yet. The issue you;re facing seems to be due to some other plugin being declared that uses that task. Can you add your gradle file?
t
Unbenannt
i am aware that i can add npm dependencies to the well known dependencies block - but how do i use webpack? especially how to i start the devserver? is there an example?
ahh having applied
kotlin("js")
./gradlew run
doing that already exists. Awesome!
but what does it serve? 🤔
b
Here's my MPP setup. replace multiplatform plugin to js and remove common and JVM configs
t
Thank you!
do you know if there is a way to serve something like an
index.kt
?
b
As in standalone js app?
You can have a look around at my current MPP project. It's using embedded kotlinJS frontend served by ktor https://gitlab.com/lt.petuska/hazelcast-explorer
👍🏻 1
If you have any more questions regarding kotlin gradle setup you can dm me
m
@Big Chungus I have one actually - have you find way to build fat.js file with new gradle js plugin?
b
You mean webpack bundle?
m
yep!
b
Kinda yes
Will post it once i get to my pc. It's still missing dce integration.
But it produces a minified bundle at least
Are you looking for standalone js or mpp setup?
m
At the momeent I`m trying to update this sample
<https://github.com/rivasdiaz/helloworld-chrome-extension-kotlin>
with kotlin 1.3.50 and KGDsl to understand what`s going on here 😃
b
Sure, will have a look later today
m
I think that I`ve made it runnable with this one - https://github.com/rivasdiaz/helloworld-chrome-extension-kotlin/pull/3 but still wan’t to avoid this
Copy code
<script src="browser-polyfill.js"></script>
    <script src="kotlin.js"></script>
    <script src="kotlinx-coroutines-core.js"></script>
    <script src="helloworld.js"></script>
b
All good, then. Glad you've managed to sort it
m
If possible - I`m still interesting how you were able to get bundle file 😃
b
Still WIP. Missing minification (configurable via webpack.d) and more dce testing
m
hi there https://github.com/avdim/kotlin-mpp-js-browser - I’ve found this sample very useful. Seems that DCE plugin works (can’t say is result good or not)
👍 1
Btw - haven’t anyone got issue when webpack bundle file is not actually js file - but file with few
eval(...)
functions with a lot of code from js files that should be actually bundled in? UPDT: It was because of dev mode of webpack and now only minification needed 😃