Is it possible to load a .txt file from the resour...
# compose-web
d
Is it possible to load a .txt file from the resources directory? I am recreating a small website I made in React using Compose for Web and am having a hard time recreating the following in Kotlin:
import TestVar from './files/TestFile.txt';
...
var text = TestVar.text();
Can I use the Kotlin/JS module system to recreate the above?
a
Yes it’s possible with proper webpack config
AFIR you need something like this
Copy code
@JsModule("./files/TestFile.txt")
@JsNonModule
external object MyText
and related loader in webpack (maybe latest webpack can do it out of the box - i don’t know its current state)
It’s better to ask in https://kotlinlang.slack.com/archives/C0B8L3U69 channel for details
👍 1