MPP JS client: Can't resolve 'text-encoding'
See original GitHub issueKtor Version
1.1.2
Ktor Engine Used(client or server and name)
Ktor client with default engine
JVM Version, Operating System and Relevant Context
JDK 1.8, Windows, Kotlin JS
Feedback
We are using the ktor client in a multiplatform project (android, iOS and web). Starting with version 1.1.0 the build of the JS client fails with the following message:
ERROR in ./kotlinx-io.js
Module not found: Error: Can't resolve 'text-encoding' in '<mypath>\kotlinmultiplatform\web\build\kotlin-js-min\main'
@ ./kotlinx-io.js 5309:21-45 5320:21-45
@ ./ktor-utils.js
@ ./web.js
If I manually add text-encoding
as a npm-dependeny, it works.
If I list the npm dependency tree with the previous working ktor version 1.0.1 I get:
+-- kotlinx-io@0.1.4 -> <mypath>\kotlinmultiplatform\web\build\node_modules_imported\kotlinx-io extraneous
+-- kotlinx-io-js@0.1.1 -> <mypath>\kotlinmultiplatform\web\build\node_modules_imported\kotlinx-io-js
| +-- kotlin@1.3.10
| +-- kotlin-test@1.3.10
| | `-- kotlin@1.3.10 deduped
| +-- kotlinx-atomicfu@0.11.12 -> <mypath>\kotlinmultiplatform\web\build\node_modules_imported\kotlinx-atomicfu deduped
| `-- text-encoding@0.7.0
If I list the npm dependency tree with a ktor version >= 1.1.0 the kotlinx-io-js
(and of course text-encoding
) is missing
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Ktor 1.5.2: Can't resolve 'node-fetch' on libs produced by ...
I'm using Ktor client with an MPP project. After upgrading to 1.5.2, I started having this error on a yarn project that is...
Read more >npm cannot find module 'encoding' - Stack Overflow
js dev server running for the application, but I actually moved the location of the app into a new folder while the server...
Read more >WhatsNew 1.3 | Ktor Framework
[JS client] Cannot change redirect policy by followRedirects=false ... MPP JS client: Can't resolve 'text-encoding'.
Read more >text-encoding - npm
Start using text-encoding in your project by running `npm i text-encoding`. There are 665 other projects in the npm registry using ...
Read more >MPP/JS code completion in HTML editor - Kotlin Discussions
However, the Intellij HMTL editor will mark ./client.js as cannot resolve file 'client.js' and code in <script> tags does not provide js code ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To fix this, I’ve added the following dependencies to my Gradle build:
This fixed the issue for me!
see https://github.com/Kotlin/kotlinx-io/issues/57 for my current work around