Define sources to be included/excluded from library-preload.js
Expected Behavior
For my library-preload.js I want to exclude individual resources from the preload bundle.
Current Behavior
For the Component-preload.js this exclusion works by declaring the bundle definition in the ui5.yaml:
builder:
bundles:
- bundleDefinition:
name: component_folder/Component-preload.js
defaultFileTypes:
- ".js"
- ".fragment.xml"
- ".view.xml"
- ".properties"
- ".json"
sections:
- mode: preload
filters:
- your_filters_here
resolve: false
bundleOptions:
optimize: true
usePredefineCalls: true
For libraries I would expect to do the same and to repeat the bundle definition in the ui5.yaml, e.g.:
builder:
bundle:
- bundleDefinition:
name: sap/ui/table/library-preload.js
defaultFileTypes:
- ".js"
- ".fragment.xml"
- ".view.xml"
- ".properties"
- ".json"
sections:
- mode: preload
filters:
- "sap/ui/table/"
- "!sap/ui/table/.library"
- "!sap/ui/table/themes/"
- "!sap/ui/table/messagebundle*"
resolve: false
resolveConditional: false
renderer: true
Steps to reproduce the issue
- Add the bundle definition above to the
ui5.yamlof sap.ui.table - Run
ui5 build
Context
- UI5 Module Version (output of
ui5 --versionwhen using the CLI):1.5.2 - Node.js Version:
not relevant - npm Version:
not relevant - OS/Platform:
not relevant
Affected components (if known)
- [X] ui5-builder
- [ ] ui5-server
- [ ] ui5-cli
- [ ] ui5-fs
- [ ] ui5-project
- [ ] ui5-logger
Ah, OK - typo!
It works when calling bundle => bundles in the builder section:
builder:
bundles:
- bundleDefinition:
name: sap/ui/table/library-preload.js
defaultFileTypes:
- ".js"
- ".fragment.xml"
- ".view.xml"
- ".properties"
- ".json"
sections:
- mode: preload
filters:
- "sap/ui/table/"
- "!sap/ui/table/.library"
- "!sap/ui/table/themes/"
- "!sap/ui/table/messagebundle*"
resolve: false
resolveConditional: false
renderer: true
But in both cases for the Component and the Library preload the bundler will run twice! First with the predefined configuration (in generateLibraryPreload) and afterwards with the bundle definition in the ui5.yaml (in generateBundle). This could eventually be simplified by just creating the bundle definition in the generate library preload task and enhance the bundle definition afterwards for the generate bundle task (just some guess).