bod
04/21/2022, 4:31 PMimplementation(npm("express", "4.17.3"))
And declared this external:
@file:JsModule("express")
@file:JsNonModule
package express
external fun express(): dynamic
But calling express()
in my code gives me:
TypeError: express_0 is not a function
Any idea why it's named express_0
in the generated js? 🤔turansky
04/21/2022, 4:34 PM@file:JsModule("express")
@file:JsNonModule
package express
@JsName("default")
external fun express(): dynamic
?ansman
04/21/2022, 4:36 PM@JsName("express")
to the external definitionbod
04/21/2022, 4:39 PM"default"
and "express"
) but am still getting the same error.turansky
04/21/2022, 4:40 PM@JsModule("express")
external fun express(): dynamic
?bod
04/21/2022, 4:41 PM@JsModule and @JsNonModule can't appear on here since the file is already marked by either @JsModule or @JsNonModule
turansky
04/21/2022, 4:41 PMbod
04/21/2022, 4:43 PMturansky
04/21/2022, 4:44 PMexpress
• Missed JsModule
configurationbod
04/21/2022, 4:47 PMMissedsorry, not sure what you mean by this oneconfigurationJsModule
turansky
04/21/2022, 4:50 PMturansky
04/21/2022, 4:53 PM// old style
@JsImport(JsImport.Namespace)
external val express(): Express
// default import
@JsImport(JsImport.Default)
external val express(): Express
// named
@JsImport("express")
external val express(): Express
turansky
04/21/2022, 4:53 PMbod
04/21/2022, 4:54 PMJsModule
vs JsNonModule
(and the docs I found were a bit taciturn)turansky
04/21/2022, 5:13 PMturansky
04/21/2022, 5:29 PM@JsImport
is more flexible, cover all cases and it’s synchronous with @JsExport
Also such scheme allows to declare extensions in the same fileturansky
04/21/2022, 10:53 PM