ui5-tooling icon indicating copy to clipboard operation
ui5-tooling copied to clipboard

Define sources to be included/excluded from library-preload.js

Open petermuessig opened this issue 6 years ago • 1 comments

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

  1. Add the bundle definition above to the ui5.yaml of sap.ui.table
  2. Run ui5 build

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 1.5.2
  • Node.js Version: not relevant
  • npm Version: not relevant
  • OS/Platform: not relevant

Affected components (if known)

petermuessig avatar Jun 23 '19 11:06 petermuessig

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

petermuessig avatar Jun 23 '19 12:06 petermuessig