Lamberto Basti
02/06/2020, 6:12 PMtext
ERROR in D:/Progetti/Android-Application/build/js/packages_imported/firebase-multiplatform-auth/0.1.8/firebase-multiplatform-auth.js
Module not found: Error: Can't resolve 'firebase.auth.ActionCodeInfo' in 'D:\Progetti\Android-Application\build\js\packages_imported\firebase-multiplatform-auth\0.1.8'
@ D:/Progetti/Android-Application/build/js/packages_imported/firebase-multiplatform-auth/0.1.8/firebase-multiplatform-auth.js 3:4-144
@ ../my-application-kodein-di/kotlin/my-application-kodein-di.js
@ ./kotlin/my-application-web-client-2.js
@ multi ./kotlin/my-application-web-client-2.js
Now, firebase.auth.ActionCodeInfo
is actually a class from the Firebase JS library for which [Dukat](https://github.com/Kotlin/dukat/) wrote [this](https://github.com/lamba92/firebase-multiplatform/blob/9dccf3e1c8b19b5181e8f02266bf6775ecd53f2c/core/src/jsMain/kotlin/firebase/auth/index.firebase.auth.module_firebase.kt#L41-L44) (that i rearranged into packages).
Why does this infernal webpack machinery looks for it inside my library instead of the Firebase one?Ivan Kubyshkin [JetBrains]
02/07/2020, 6:50 AMLamberto Basti
02/07/2020, 9:47 AMIlya Goncharov [JB]
02/07/2020, 10:52 AM@file:JsModule("firebase")
@file:JsNonModule // necessary for umd
@file:JsQualifier("auth")
Lamberto Basti
02/07/2020, 12:47 PMLamberto Basti
02/07/2020, 1:01 PM@JsModule("firebase")
errors anyway šLamberto Basti
02/07/2020, 1:30 PMIlya Goncharov [JB]
02/07/2020, 1:33 PMLamberto Basti
02/07/2020, 2:29 PMLamberto Basti
02/07/2020, 2:52 PMIlya Goncharov [JB]
02/07/2020, 3:05 PMexternals
(https://webpack.js.org/configuration/externals/)
Sorry, what command do you use for build? I canāt use webpack tasks in your projectLamberto Basti
02/07/2020, 3:28 PMweb-client-2:browserDevelopmentRun
Lamberto Basti
02/07/2020, 3:30 PMproperties.gradle
acconding to the one published. I was iterating using MavenLocal so the version may not be the sameLamberto Basti
02/07/2020, 3:31 PMLamberto Basti
02/07/2020, 3:37 PMLamberto Basti
02/07/2020, 3:45 PMfirebase-mpp
and run ./gradlew web-client-2:browserDevelopmentRun
and it will error with:
ERROR in D:/Progetti/Android-Application/build/js/packages_imported/firebase-multiplatform-auth/0.1.10/firebase-multiplatform-auth.js
Module not found: Error: Can't resolve 'firebase.auth.ActionCodeInfo' in 'D:\Progetti\Android-Application\build\js\packages_imported\firebase-multiplatform-auth\0.1.10'
@ D:/Progetti/Android-Application/build/js/packages_imported/firebase-multiplatform-auth/0.1.10/firebase-multiplatform-auth.js 1715:37-76
@ ../my-application-kodein-di/kotlin/my-application-kodein-di.js
@ ./kotlin/my-application-web-client-2.js
@ multi ./kotlin/my-application-web-client-2.js
Ilya Goncharov [JB]
02/08/2020, 3:59 PMLamberto Basti
02/09/2020, 11:36 AMweb-client-2:browserDevelompentRun
triggers the runtime error.
Also, in this commit you have to go in gradle.properties
and change firebaseMultiplatformVersion
to 0.1.8
.Ilya Goncharov [JB]
02/09/2020, 2:08 PMfirebase-mpp
The first (it is why you faced with the first problem) you need to change declaration of
external object Operations
It should be something like
@file:JsModule("firebase")
@file:JsNonModule
@file:JsQualifier("auth")
package firebase.auth
@JsName("ActionCodeInfo")
external object Operations
But further you faced with other problems, the second one you need to change all patterns like
@file:JsQualifier("firebase.storage")
or
@file:JsQualifier("firebase.auth")
on
@file:JsModule("firebase")
@file:JsNonModule
@file:JsQualifier("auth") // or storage and so on
cc @[JB] ShagenLamberto Basti
02/09/2020, 4:57 PMOperations
error?Ilya Goncharov [JB]
02/09/2020, 5:53 PMJsModule
means that you find package with that name, so you have only firebase
npm package, and you need declare module only with firebase
not all path
If you have some hierarchy, you can use JsQualifier
to model namespaces
And finally, these operations are declared in real js object with name ActionCodeInfo
so if you want to use custom name in Kotlin, you need to declare real js name in @JsName
Lamberto Basti
02/09/2020, 6:14 PMActionCodeInfo
actually exists there! Have a look here:
https://firebase.google.com/docs/reference/js/firebase.auth.ActionCodeInfoIlya Goncharov [JB]
02/09/2020, 8:04 PMOperations
class this header
@file:JsModule("firebase")
@file:JsNonModule
@file:JsQualifier("auth.ActionCodeInfo")
package firebase.auth
@JsName("Operation")
external object Operations {
It means, that you require firebase
module, and go to ānamespaceā firebase.auth.ActionCodeInfo
and get object named Operation
Ilya Goncharov [JB]
02/09/2020, 8:07 PM@JsModule
Namespace inside this module - @JsQualifier
Real name of declaration (optional if name is the same) - @JsName
Ivan Kubyshkin [JetBrains]
02/10/2020, 7:45 AMLamberto Basti
02/10/2020, 11:35 AMIlya Goncharov [JB]
02/10/2020, 12:00 PMkotlinx.serialization
It doesnāt mean that if you can interact through Kotlin types, you will got problems surely, but in some specific and very complex cases, JS environment can show itselfLamberto Basti
02/10/2020, 12:05 PMIlya Goncharov [JB]
02/10/2020, 12:11 PMwebpack.config.d
and create js file with any name, and content which configure library mode for webpack (https://webpack.js.org/configuration/output/#outputlibrary)
config.output = config.output || {} // just in case where config.output is undefined
config.output.library = "libraryName" // should be valid js variable name
It forces webpack to put all your export to js variable libraryName
You can additionally set js module system (https://webpack.js.org/configuration/output/#outputlibrarytarget) if you want
You can find example here
https://github.com/ilgonmic/kotlinjs-multi-module/blob/master/app/webpack.config.d/library.jLamberto Basti
02/10/2020, 9:54 PM