Using the new kotlin/js 1.3.70, how do I get my de...
# javascript
r
Using the new kotlin/js 1.3.70, how do I get my dependencies (i.e. kotlin.js) in the distribution folder with dce applied to it? Or even better, can I get the dependencies included in one js file?
i
After
build
task you get
build/distributions
folder with one js bundle with all included dependencies
r
Ok, this works for me on a newly created project, so that's good. But when trying to migrate an existing mpp project I get an error where a dependency depending on kotlin.js is loaded before kotlin.js. I am guessing the dependency (https://github.com/rnentjes/komponent) needs to be updated. Anyone has an example of how to create a library for kotlin-js/mpp 1.3.70?
Otherwise I'll take a look at an mpp lib like serialization.
s
@Ilya Goncharov [JB] does this use all the DCE’d libraries from the gradle import? I have a very simple network request but the whole *.js output is sitting at 2mb
r
I made a minimal example (https://gitbucket.astraeus.nl/rnentjes/test-pure-kotlin-js) and updated the included project (https://gitbucket.astraeus.nl/rnentjes/komp) and it gives the following error when running browserDevelopmentRun:
komp.js:2 Uncaught Error: Error loading module 'komp'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'komp'.
at eval (komp.js:2)
at Object.../../packages_imported/komp/0.1.16-SNAPSHOT/komp.js (test-pure-kotlin-js.js:477)
at __webpack_require__ (test-pure-kotlin-js.js:30)
at eval (test-pure-kotlin-js.js:3)
at eval (test-pure-kotlin-js.js:8)
at Object../kotlin/test-pure-kotlin-js.js (test-pure-kotlin-js.js:510)
at __webpack_require__ (test-pure-kotlin-js.js:30)
at Object.0 (test-pure-kotlin-js.js:522)
at __webpack_require__ (test-pure-kotlin-js.js:30)
at test-pure-kotlin-js.js:94
eval @ komp.js:2
../../packages_imported/komp/0.1.16-SNAPSHOT/komp.js @ test-pure-kotlin-js.js:477
__webpack_require__ @ test-pure-kotlin-js.js:30
eval @ test-pure-kotlin-js.js:3
eval @ test-pure-kotlin-js.js:8
./kotlin/test-pure-kotlin-js.js @ test-pure-kotlin-js.js:510
__webpack_require__ @ test-pure-kotlin-js.js:30
0 @ test-pure-kotlin-js.js:522
__webpack_require__ @ test-pure-kotlin-js.js:30
(anonymous) @ test-pure-kotlin-js.js:94
(anonymous) @ test-pure-kotlin-js.js:97
webpackUniversalModuleDefinition @ test-pure-kotlin-js.js:9
(anonymous) @ test-pure-kotlin-js.js:10
client?fdcd:52 [WDS] Live Reloading enabled.
Turns out there where some subtle changes with previous versions. For one the artifact name now gets the -js addition automatically. Any dependencies of dependencies are not automatically included anymore, this probably required some extra configuration now (?)
👍 1