Resolving the export conflicts
PradeepKiruvale opened this issue · 3 comments
Hi All,
When two components export the same symbols, and they are being composed to have a single component, then there will be a conflict of symbols. How does the WAC resolve/address this? Because the composed component must export all the export calls from both the components. Please help me how to resolve this issue.
Thanks & Regards,
Pradeep
The resulting composition does not need to export all exports from the input components. If you're using a wac script along with wac encode
, then the way to export an item from the resulting composition is by using an explicit export
statement. If two items have the same name, then you can use the as
keyword to rename one or both of the items. You can learn more about that here.
For example, here's two input components have the same export my-export
but that each end up with different names in the resulting compositions.
let my-export1 = new a:b { ... }.my-export;
let my-export2 = new c:d { ... }.my-export;
export my-export1 as "my-export1";
export my-export2 as "my-export2";
Let me know if this answers your question about your specific use case.
Thanks for the reply, it's useful. So, when the glue code is generated while composing, this mapping/Renaming of APIS happens in that glue code, right? This does not need any manual intervention here, right?
Correct, the export
statements in the wac file do the mapping and renaming so no additional steps should be required. Going to close this, but let me know if you have any more questions.