-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Bundle require
section with async flag for specVersion: 4.0
#1042
Changes from all commits
c457608
1b6c921
e390877
4c8d22d
702ea88
bb33e24
31c2bca
50a1979
7916be7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Applies default values to bundleDefinitions | ||
* | ||
* @param {module:@ui5/builder/processors/bundlers/moduleBundler~ModuleBundleDefinition} bundleDefinition Module | ||
* bundle definition | ||
* @param {@ui5/project/build/helpers/TaskUtil|object} [taskUtil] TaskUtil | ||
* | ||
* @returns {module:@ui5/builder/processors/bundlers/moduleBundler~ModuleBundleDefinition} | ||
*/ | ||
export function applyDefaultsToBundleDefinition(bundleDefinition, taskUtil) { | ||
bundleDefinition.sections = bundleDefinition?.sections?.map((section) => { | ||
const defaultValues = { | ||
resolve: false, | ||
resolveConditional: false, | ||
renderer: false, | ||
sort: true, | ||
declareRawModules: false, | ||
}; | ||
|
||
// Since specVersion: 4.0 "require" section starts loading asynchronously. | ||
// If specVersion cannot be determined, the latest spec is taken into account. | ||
// This is a breaking change in specVersion: 4.0 | ||
if (section.mode === "require" && (!taskUtil || taskUtil.getProject().getSpecVersion().gte("4.0"))) { | ||
defaultValues.async = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a test that verifies this behavior? I tested this with a self-contained build and even with specVersion 3.0 I get an async require section, which is not expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also document the "async" option in the respective JSDoc: https://github.com/SAP/ui5-builder/blob/main/lib/processors/bundlers/moduleBundler.js#L13 |
||
} | ||
|
||
return Object.assign(defaultValues, section); | ||
}); | ||
|
||
return bundleDefinition; | ||
} |
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.
obsolete parameter? or was it already in use but undocumented?
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 have removed it in https://github.com/SAP/ui5-builder/pull/1036/files#diff-255002459f4f366a0dceae0db4927dd06d44894f887b3ba210884d9a399f48d1L138