ui5-migration
ui5-migration copied to clipboard
'migrate' tends to add a dependency to the module itself
While working on https://github.com/SAP/openui5/commit/c782ce9be8cbd71201e19ba3cb4c0e81e439b71f , I encountered the following issue with the ui5-migration tooling:
When the source of a module contains a global reference to the export of the same module, then the 'migrate' command adds a dependency to self and tries to use the resulting import whenever the export value is references. This happens in nearly each library.js module, but also in a few others.
Before
sap.ui.define([
'sap/ui/core/library', // library dependency
'sap/ui/commons/library'], // library dependency
function() {
...
return sap.ui.ux3;
After (please also note that the 'library dependency' comments are also misplaced)
sap.ui.define([
"sap/ui/ux3/library", // library dependency
'sap/ui/core/library',
'sap/ui/commons/library'], // library dependency
function(ux3Library) {
...
return ux3Library;
});
To reproduce, you can execute the following commands
cd openui5
git checkout 6555a38
ui5-migration migrate src/sap.ui.ux3/src/sap/ui/ux3/library.js
ui5-migration migrate src/sap.ui.core/src/sap/ui/core/support/Support.js