Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Usage of sap.ui.require.preload for library-preload.js >=1.54 #65

Merged
merged 2 commits into from
Mar 12, 2018

Conversation

petermuessig
Copy link
Contributor

@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.

@CLAassistant
Copy link

CLAassistant commented Mar 5, 2018

CLA assistant check
All committers have signed the CLA.

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) {
Copy link
Contributor Author

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

Copy link
Contributor

@matz3 matz3 left a 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
Copy link
Contributor

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);
Copy link
Contributor

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 matz3 merged commit 6fac9ff into master Mar 12, 2018
@matz3 matz3 deleted the new-preload-format branch March 12, 2018 12:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReferenceError: jQuery is not defined
3 participants