ui5-community / babel-plugin-transform-modules-ui5

A Babel transformer plugin for OpenUI5/SAPUI5. It allows you to develop UI5 applications by using the latest ECMAScript or TypeScript, including new syntax and objective oriented programming technology.
MIT License
34 stars 16 forks source link

fix: dynamic import must not handle __esModule flagged modules #93

Closed petermuessig closed 1 year ago

petermuessig commented 1 year ago

Standard NPM packages like jsPDF are also detected as static objects but compared to UI5 static objects they must not be returned as default.

NPM static objects:

(await import("jsPDF")); // { __esModule: true, jsPDF: /* jsPDF class */, ... }
(await import("sap/m/MessageBox")).jsPDF // jsPDF

UI5 static object:

(await import("sap/m/MessageBox")) // { __esModule: true, default: /* sap/m/MessageBox */... }
(await import("sap/m/MessageBox")).default // sap/m/MessageBox
(await import("sap/m/MessageBox")).default.alert // sap/m/MessageBox#alert