Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

HMR not working correctly with Kotlin >= 1.3.20 #140

Open
rjaros opened this issue Feb 12, 2019 · 2 comments
Open

HMR not working correctly with Kotlin >= 1.3.20 #140

rjaros opened this issue Feb 12, 2019 · 2 comments

Comments

@rjaros
Copy link

rjaros commented Feb 12, 2019

Since Kotlin version 1.3.20 HMR feature doesn't work correctly. The command ./gradlew -t run fails to rebuild the project after any change in the source code with an error like this:

ℹ 「wdm」: Compiling...
✖ 「wdm」: 
ERROR in ./frontend-only.js
Module build failed: Error: ENOENT: no such file or directory, open '/home/rjaros/git/github/kotlin-frontend-plugin/examples/frontend-only/build/js/frontend-only.js'
 @ multi webpack-dev-server/client?http://localhost:8088/ webpack/hot/dev-server ./frontend-only main[2]
ℹ 「wdm」: Failed to compile.

Similar error is displayed in the browser console window:

[HMR] Checking for updates on the server...
VM1602 log.js:26 [HMR] Cannot apply update. Need to do a full reload!
VM1602 log.js:26 [HMR] Error: Module build failed: Error: ENOENT: no such file or directory, open '/home/rjaros/git/github/kotlin-frontend-plugin/examples/frontend-only/build/js/frontend-only.js'
    at eval (webpack:///./frontend-only.js?:1:7)
    at Object../frontend-only.js (http://localhost:8088/main.f36273106d42fe3ef207.hot-update.js:16:1)
    at __webpack_require__ (http://localhost:8088/main.bundle.js:724:30)
    at hotApply (http://localhost:8088/main.bundle.js:657:14)
    at http://localhost:8088/main.bundle.js:314:22

There are some conditions to see this error:

  • Kotlin 1.3.20 or later (no problem up to 1.3.11)
  • webpack mode set to "development" in build.gradle ("production" mode fails sometimes, but not always)
  • "kotlin-dce-js" plugin disabled in build.gradle

The official "frontend-only" example can be used to reproduce this error after making the above changes in the build.gradle file.

Looking up the changelog for Kotlin 1.3.20 I've noticed this change: "KT-28842 Enable JS IC by default", which looks suspiciously, but disabling IC with kotlin.incremental.js=false doesn't solve the problem.

@wem
Copy link
Contributor

wem commented Feb 15, 2019

I did not dive into, but the EOENT failure sound like a problem i got. I also never did use HMR, but may this workaround helps: https://discuss.kotlinlang.org/t/kotlin-js-incremental-compilation/11380

I hope it helps

@rjaros
Copy link
Author

rjaros commented Feb 15, 2019

Thanks. I can confirm that both disabling incremental compilation and additional webpack configuration from https://discuss.kotlinlang.org/t/kotlin-js-incremental-compilation/11380/2 fixes the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants