What is the current way to work with JS library im...
# javascript
a
What is the current way to work with JS library imports. There was a function js.require at some moment, but I do not see it now,
r
And
require
was never in stdlib
a
Yes, it was in kotlin extensions and it was used to load resources. For example css files. How do I do it now?
r
Also with
@JsModule
You can now use
useEsModules()
in your build configuration and use simple
@JsModule
for every kind of imports (without
@JsNonModule
)
a
Is there an example for that? Usually JsModule annotation is used on external classes. But in case of css there are not external classes. So what should I annotate?
r
Copy code
@JsModule("css/style.css")
external val styleCss: dynamic
t
Also you can use standard import function
a
@turansky thanks, it seems that import is what I was searching for. @Robert Jaros, also thanks. It is a more roundabout way, but should work.
t
inline
sometimes isn't really inline. And
path
can be declared as temp variable - Webpack won't be happy 😞 Temp pill - use
importAsync
+
await()
👍 1
If pill will be required/not required - please write here (probably it's not a problem for newest version)