Title
b

bj0

11/28/2018, 6:51 PM
g

gildor

11/29/2018, 3:30 AM
Yes, you can do that, just use external declaration You need something like (not sure that code is correct)
external fun <T> import(path: String): Promise<T>
b

bj0

11/29/2018, 4:03 AM
Oh ok, I was trying to use
js()
and was getting "javascript syntax error"
I'll have to test it out, but do you know if this lets webpack split the code so it can be loaded on demand?
Ok I tried defining the external
import
like you posted and when I try to build I get
syntax error
(in the javascript)
g

gildor

11/29/2018, 5:39 AM
any error messages?
what is in compiled code?
Also, what kind T of generic did you use?
Ahhh
I see what you mean
If I try to run DCE I also getting syntax error
but it compiles without it
looks like a compiler bug
I created an issue about this DCE bug https://youtrack.jetbrains.com/issue/KT-28523
b

bj0

11/29/2018, 4:02 PM
Ah ok, nice find. I was applying the DCE plugin
I got a chance to finally run some tests, even though it compiles with DCE plugin disabled, the import statements fail with "Cannot find module", even though they are included in
package.json