Control Sources Packaged into Component-Preload.js
See original GitHub issueExpected Behavior
I want to be able to control which files are assembled into Component-preload.js via the projects config (ui5.yaml
).
Current Behavior
If found that the task @ui5/builder.tasks.generateComponentPreload
has a parameter paths
that can be used for that purpose but I can’t find anything on the expected format nor can I manage to force it to do what I want…
I’m trying to achieve something like this (exclude folder localService
from preload):
specVersion: '1.0'
metadata:
name: test
namespace: "my.test.namespace"
type: application
builder:
componentPreload:
namespaces:
- "my.test.namespace"
paths:
- "**/*.js"
- "**/!localService/**/*"
Console Output
ERR! builder:builder Build failed in 17 s Error: Resource /resources/my.test.namespace/Component-preload.js has no content at Resource.getStream (node_modules/@ui5/cli/node_modules/@ui5/fs/lib/Resource.js:173:10) at Promise (node_modules/@ui5/cli/node_modules/@ui5/fs/lib/adapters/FileSystem.js:223:14) at new Promise (<anonymous>) at FileSystem._write (node_modules/@ui5/cli/node_modules/@ui5/fs/lib/adapters/FileSystem.js:199:10) at <anonymous>
Affected components (if known)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Hi @cschuff,
the
@ui5/builder.tasks.generateComponentPreload
creates a bundle for each of the found Component.js file. It includes recursively all files (*.{js,json,xml,html,properties,library}) start from the folder which contains the Component.js file. The customized filtering can’t be applied to the bundle generation.The
paths
parameter controls from which folder the Component.js file(s) can be found.If you want to generate a custom bundling with self-controlled filters, you can try to use
@ui5/builder.tasks.generateBundle
task by writting the following to your ui5.yaml file:The default options for generate Component-preload.js can be found in code https://github.com/SAP/ui5-builder/blob/master/lib/tasks/bundlers/generateComponentPreload.js#L62
I will keep this issue open because we still need to document the options which can be used in bundleDefinition. And you can already try this out.
Best regards, Jiawei
Hey guys, thanks for the efforts and explanations. This really was a time ago so I guess we can close this issue. I’m not following up on the topic. BR