spierce7
02/26/2020, 3:34 AM$$importsForInline$$,com,firebase
Firebase basically expects a node file with only firebase functions exported. How can I achieve this?turansky
02/26/2020, 9:59 AMcom
, firebase
- package names?anton.bannykh
02/26/2020, 10:47 AMturansky
02/26/2020, 10:55 AMI don't think there is a way to limit exports in the Kotlin/JS compiler output.It can be modified via Webpack configuration.
turansky
02/26/2020, 10:59 AMoutput.libraryExport
property or via Gradle plugin - https://github.com/turansky/kfc-plugins#componentanton.bannykh
02/26/2020, 11:31 AMoutput.libraryExport
may be used to modify the package (require('foo').org.blah.A
-> require('foo').A
), but cannot be used to remove some exports, while keeping the others.
I suspect there should be some JS tool to remove some exports from a module, but I don't think that's it.anton.bannykh
02/26/2020, 11:36 AMinternal
and pass the -Xfriend-modules-disabled
flag to the compiler. That would prevent the compiler from exporting internal
declarations.turansky
02/26/2020, 12:31 PMbut cannot be used to remove some exports@anton.bannykh I have example for this theme. I use DCE to keep only required, but in common case
output.libraryExport
does the same job.
Example
// exported
aaa.ComponentA
bbb.ComponentB
ccc.ComponentC
+
output.libraryExport = ["bbb"]
=
// exported
ComponentB
https://github.com/turansky/kfc-plugins/tree/master/examples/component-extensionIlya Goncharov [JB]
02/26/2020, 1:22 PMorg.example
And then you can tell webpack to export only this package via output.libraryExport=['org', example']
, it means that your object will contain only declarations from package org.example
You can set libraryExport
manually with webpack.config.d/library.js
:
// it will be redundant in 1.3.70
config.output = config.output || {}
config.output.library = <module-name>
config.output.libraryTarget = 'umd'
// it is necessary both before 1.3.70 and in 1.3.70
config.output.libraryExport = ['org', example']
spierce7
02/26/2020, 1:47 PMIlya Goncharov [JB]
02/26/2020, 1:50 PManton.bannykh
02/27/2020, 10:26 AMIlya Goncharov [JB]
02/27/2020, 11:00 AMbut in common case@turansky I just want to tell about difference, that it is correct only for export, you’re right, that from export point of view effect is the similar, but the main difference, that in factdoes the same job.output.libraryExport
libraryExport
don’t remove signature, and they are in the code anyway, but DCE really remove declarations, and reduce file sizeturansky
02/27/2020, 11:31 AMspierce7
02/27/2020, 2:53 PM