I'm getting the error Function <init> should...
# compose-web
l
I'm getting the error Function <init> should have been replaced by compiler when trying to open my
index.html
file.
đŸ‘€ 1
jsBrowserDevelopmentRun runs fine
jsBrowserRun too
Not sure if this helps
Copy code
Uncaught 
Object { message: "Function <init> should have been replaced by compiler.", cause: undefined, name: "IllegalStateException", stack: "captureStack@https://beta.semudando.com.br/SeMudandoFront.js:6540:26\nIllegalStateException_init_$Create$@https://beta.semudando.com.br/SeMudandoFront.js:7762:17\nillegalDecoyCallException@https://beta.semudando.com.br/SeMudandoFront.js:25288:11\nPage@https://beta.semudando.com.br/SeMudandoFront.js:34329:30\nPage_initEntries@https://beta.semudando.com.br/SeMudandoFront.js:34325:26\nPage_Home_getInstance@https://beta.semudando.com.br/SeMudandoFront.js:34523:5\n_no_name_provided__218.prototype.invoke_ovmwdp_k$@https://beta.semudando.com.br/SeMudandoFront.js:34386:31\n_no_name_provided_$factory_201/<@https://beta.semudando.com.br/SeMudandoFront.js:34533:9\nComposableLambdaImpl.prototype.invoke_oku154_k$@https://beta.semudando.com.br/SeMudandoFront.js:28042:92\nTagElement$composable@https://beta.semudando.com.br/SeMudandoFront.js:30151:50\nDiv$composable@https://beta.semudando.com.br/SeMudandoFront.js:30858:28\n_no_name_provided__219.prototype.invoke_9m2agf_k$@https://beta.semudando.com.br/SeMudandoFront.js:34450:21\n_no_name_provided_$factory_202/<@https://beta.semudando.com.br/SeMudandoFront.js:34540:9\nComposableLambdaImpl.prototype.invoke_oku154_k$@https://beta.semudando.com.br/SeMudandoFront.js:28042:92\n_no_name_provided__104.prototype.invoke_5vwf3d_k$@https://beta.semudando.com.br/SeMudandoFront.js:28463:44\n_no_name_provided_$factory_89/<@https://beta.semudando.com.br/SeMudandoFront.js:28531:9\nComposableLambdaImpl.prototype.invoke_uhotyh_k$@https://beta.semudando.com.br/SeMudandoFront.js:28026:92\ninvokeComposable$composable@https://beta.semudando.com.br/SeMudandoFront.js:27901:15\n_no_name_provided__61.prototype.invoke_sv8swh_k$@https://beta.semudando.com.br/SeMudandoFront.js:15351:34\n_no_name_provided_$factory_56/<@https://beta.semudando.com.br/SeMudandoFront.js:16713:9\nobserveDerivedStateRecalculations@https://beta.semudando.com.br/SeMudandoFront.js:22403:7\ndoCompose$composable@https://beta.semudando.com.br/SeMudandoFront.js:14872:44\nComposerImpl.prototype.composeContent$composable_4zlj5u_k$@https://beta.semudando.com.br/SeMudandoFront.js:15821:25\nCompositionImpl.prototype.composeContent$composable_wte2v3_k$@https://beta.semudando.com.br/SeMudandoFront.js:17669:42\nRecomposer.prototype.composeInitial$composable_tcddod_k$@https://beta.semudando.com.br/SeMudandoFront.js:19927:37\nCompositionImpl.prototype.setContent$composable_wte2v3_k$@https://beta.semudando.com.br/SeMudandoFront.js:17655:20\nrenderComposable$composable_0@https://beta.semudando.com.br/SeMudandoFront.js:28436:17\nrenderComposable$composable$default@https://beta.semudando.com.br/SeMudandoFront.js:28446:12\nrenderComposable$composable@https://beta.semudando.com.br/SeMudandoFront.js:28428:12\nmain@https://beta.semudando.com.br/SeMudandoFront.js:34315:32\n@https://beta.semudando.com.br/SeMudandoFront.js:41855:3\n@https://beta.semudando.com.br/SeMudandoFront.js:7:27\n@https://beta.semudando.com.br/SeMudandoFront.js:8:2\n" }
Recomposer.kt:726:8
The full source can be found here
s
It means that some constructor is not correctly transformed with compiler plugin Could you recheck you apply the plugin correctly and file an issue in GitHub?
o
Apparently enum with composable doesn't work well in production executable (although works in dev executable). Just in case, you can use sealed class instead of enum:
Copy code
sealed class Page(
    val title: String,
    val compose: @Composable () -> Unit
) {
    object Home : Page("InĂ­cio", { HomePage() })
    object WhoWeAre : Page("Quem somos", { WhoWeArePage() })
}
Anyway, an issue on github will be very much helpful đŸ™‚
l
Interesting! I'll open an issue
@Oleksandr Karpovich [JB] https://github.com/JetBrains/compose-jb/issues/1246 I opened this issue. Could you triage it? I'd like to work on it
(no idea where to start tho)
Apparently enum with composable doesn't work well in production executable (although works in dev executable).
A new version of "it works on my machine"