Is there supposed to be a difference between using...
# javascript
m
Is there supposed to be a difference between using @file:JsModule and @file:JsNonModule , then having an external class / function, and directly annotating the external class/function with @JsModule and @JsNonModule ? Strangely enough I found when trying to make a wrapper for compressorjs (image compressor), using the file annotations didn't work (kept getting the result as "undefined"). When I put the annotations directly on the external declaration itself, it worked.
t
@JsNonModule
has no sense in 2023 😞 For global/browser external types/functions you need
external
modifier only For external types/functions from libraries you need
external
modifier and
@JsModule
annotation
In Kotlin Wrappers we have 0
@JsNonModule
usages
m
I thought if I put @file:JsModule in the file, and then use an external declaration in the same file, that was the same as putting the @JsModule declaration on the external declaration itself
I think for UMD I can remove the JsNonModule..
t
AFAIK - UMD will request
@JsNonModule
You can use ES or CommonJS module kind to avoid redundant annotation
m
Then I would somehow need to tell webpack what version of the npm I want...
🚫 1
... it seems to have imported the umd version of compressor, although my gradle has useCommonJs()
t
although my gradle has useCommonJs()
In that case
@JsNonModule
has zero effect
👍 1
m
Will try removing it and hoping nothing explodes
Thanks @turansky - seems fine now.
😉 1