Hi! Did somebody encounter this problem before? ``...
# javascript
c
Hi! Did somebody encounter this problem before?
Copy code
Uncaught TypeError: Cannot read properties of undefined (reading 'z')
    at Object.<anonymous> (ThreadLocal.kt:31:1)
    at ThreadLocal.kt:31:1
    at ./node_modules/akoskmm/packages/apilib/kotlin/apilib.js (ThreadLocal.kt:31:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./src/App.js (logo.svg:29:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
Looks like an issue with stately
<http://localhost:3000/runner/work/Stately/Stately/stately-concurrency/src/jsMain/kotlin/co/touchlab/stately/concurrency/ThreadLocal.kt>
a
Could I ask to to create a ticket with the reproducer?
c
Sure. I will try to find some time for it in the following days.
a
Thank you 🙏
a
ThreadLocal.kt is js?? that is interesting
c
So the problem is with the multi module projects. I have a multi module project (2 KMP module, core and client). RockieHUN/ThreadLocalReproducer (github.com) Client module depends on Core module. • I build the library with the
jsBrowserProductionWebpack
task of the client module. • I export the package to an npm registry • If I import it to a js project (RockieHUN/thread_local_reproducer_js (github.com)) the application instant crashes with similar error.
Copy code
bootstrap:27  Uncaught TypeError: Cannot read properties of undefined (reading 'a')
    at Object.<anonymous> (index.js:7:1)
    at index.js:7:1
    at ./node_modules/threadlocalreproducer/packages/apilib/kotlin/apilib.js (index.js:7:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./src/App.js (logo.svg:29:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
It look like its not related to ThreadLocal. What is 100% that it happens with multi module projects. I am not sure if it is a bug or I am doing something wrong. What do you think? If you say it is worth creating a ticket, I will do it.
a
I am extensively using multi modules with multiplatform (including kotlin/js). And it works, You need to create a ticket and within it, the possible smallest reproducer of your issue. Then it'll be easy to get help. coz we will have much information than we have now
I see the code you posted is a reproducer already. Let me try going through it and see
👍 1
c
Created the ticket. Btw, no clue what is the exact cause of the issue. My only guess , for now , is the multi module setup, because the reproducer is almost empty. KMP crash with multi module project (Kotlin/JS) : KT-65309 (jetbrains.com)
Update: I was using incorrect package.json file while exporting the library and this is why I was getting this error.