-
Notifications
You must be signed in to change notification settings - Fork 34
Usage of sap.ui.require.preload for library-preload.js >=1.54 #65
Conversation
tasks/preload.js
Outdated
// workaround for new modules based on sap.ui.predefine | ||
return 'sap.ui.require.preload(' + JSON.stringify(preloadObject.modules, null, '\t') + ', "' + preloadObject.name + '");'; | ||
}; | ||
} else if (iMajor === 1 && iMinor >= 40 && iMinor < 54) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The < minor version 54 is not really required but makes it easier to understand the check and would be safe when moving later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also adopt the Component-preload format.
I will do the changes 😄
tasks/preload.js
Outdated
// Build library-preload as .js file | ||
preloadInfo.ext = ".js"; | ||
preloadInfo.processContent = function(content, preloadObject) { | ||
// workaround for new modules based on sap.ui.predefine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather call this the new API, not a workaround. I also think it's not really coupled to the sap.ui.predefine format.
tasks/preload.js
Outdated
@@ -295,7 +302,7 @@ module.exports = function (grunt) { | |||
|
|||
var content = JSON.stringify(preloadObject, null, '\t'); | |||
if (typeof preloadInfo.processContent === 'function') { | |||
content = preloadInfo.processContent(content); | |||
content = preloadInfo.processContent(content, preloadObject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should now better only pass the preloadObject
in here and both implementations should do the JSON.stringify on their own.
@matz3 this enables to create library-preload.js files with sap.ui.require.preload for >=1.54 and will fix the issue with the current 1.54 bower releases (jQuery is not defined issues) - should fix: SAP/openui5-sample-app#28 once we adopt the bower releases.