You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the type is something only important to Typescript, it shouldn't be transpiled. But, when I go through typescript-preset and then through transform-modules-ui5, this is the result:
The type ends up being transpiled: __exports.testType = testType;, even though it's not on Typescript's transpiling. Maybe there's a need to test the exports of a file before outputting them to JS, as testType ends up having no reference in the file and we get a runtime error.
Then, much, much later, it builds the sap.ui.define wrapper based on the export declarations it has removed previously, even if another plugin has removed the remaining declaration in the meantime.
Testing whether the to-be-exported identifier still exists within the file's scope might be possible, but it's IMO a bandaid for a deeper design problem. The ExportNamedDeclaration handler and its siblings should be moved to a nested traverse call in the Program exit handler.
When I write a typescript file like this:
And run it using babel's typescript-preset, it transpiles to this:
As the type is something only important to Typescript, it shouldn't be transpiled. But, when I go through typescript-preset and then through transform-modules-ui5, this is the result:
The type ends up being transpiled:
__exports.testType = testType;
, even though it's not on Typescript's transpiling. Maybe there's a need to test the exports of a file before outputting them to JS, astestType
ends up having no reference in the file and we get a runtime error.I have an example on this repo: https://github.com/lucasheim/transform-ui5-playground
The text was updated successfully, but these errors were encountered: